Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deploy stuff

  • Loading branch information...
commit e26494651c5bb3796875af488c0ac9c6350fb529 1 parent 41f8b84
@issackelly authored
View
1  Procfile
@@ -1 +1,2 @@
web: bin/python manage.py run_gunicorn 0.0.0.0:$PORT
+worker: bin/python manage.py celeryd -l info
View
0  deploy/__init__.py
No changes.
View
3  deploy/gunicorn.conf.py
@@ -0,0 +1,3 @@
+bind = "127.0.0.1:7026"
+logfile = "/home/serveruser/logs/sc2tourney/gunicorn.log"
+workers = 3
View
22 deploy/nginx.conf
@@ -0,0 +1,22 @@
+upstream sc2tourney {
+ server 127.0.0.1:7026 fail_timeout=0;
+}
+server {
+ listen 80;
+ server_name pyconsc2.issackelly.com;
+
+ location /site_media/ {
+ root /home/serveruser/development-sites/sc2tourney/sc2tourney;
+ }
+ location / {
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Host $http_host;
+ proxy_redirect off;
+ client_max_body_size 16m;
+
+ if (!-f $request_filename) {
+ proxy_pass http://sc2tourney;
+ break;
+ }
+ }
+}
View
20 deploy/supervisord.conf
@@ -0,0 +1,20 @@
+[program:sc2tourney]
+command=/home/serveruser/.virtualenvs/sc2tourney/bin/gunicorn_django -c deploy/gunicorn.conf.py
+environment=PYTHONPATH=/home/serveruser/development-sites/sc2tourney
+directory=/home/serveruser/development-sites/sc2tourney
+user=nobody
+startsecs=25
+autostart=true
+autorestart=true
+redirect_stderr=True
+
+[program:sc2tourney_celery]
+command=/home/serveruser/.virtualenvs/sc2tourney/bin/python manage.py celeryd -l INFO
+directory=/home/serveruser/development-sites/sc2tourney/
+user=nobody
+stdout_logfile=/home/serveruser/logs/sc2tourney/celeryd.log
+stderr_logfile=/home/serveruser/logs/sc2tourney/celeryd.log
+autostart=true
+autorestart=true
+startsecs=10
+stopwaitsecs = 600
View
8 requirements.txt
@@ -3,14 +3,18 @@
-e git+https://github.com/pinax/pinax-theme-bootstrap.git#egg=Pinax_Theme_Bootstrap
-e git://github.com/django-debug-toolbar/django-debug-toolbar.git#egg=debug_toolbar
-e hg+https://bitbucket.org/andrewgodwin/south@126a1ad2ee9d#egg=South
--e git+https://github.com/issackelly/sc2reader#egg=sc2reader
+-e git+https://github.com/issackelly/sc2reader@new_data#egg=sc2reader
-e hg+https://bitbucket.org/ubernostrum/django-registration#egg=django_registration
django-pagination
psycopg2
gunicorn
+celery
+redis
PIL
mercurial==2.0.2
-# for reading replays
+boto==2.0
+django-ses==0.2
+django-celery
View
11 sc2match/tasks.py
@@ -1,12 +1,15 @@
-from sc2match.models import PlayerResult, Map #Match
+from sc2match.models import PlayerResult, Map, Match
from profiles.models import Player
+from celery.decorators import task
+
def as_signal(sender, instance, created, raw, **kwargs):
if created:
- parse_replay(instance)
-
-def parse_replay(match):
+ parse_replay(instance.id)
+@task
+def parse_replay(match_id):
+ match = Match.objects.get(id=match_id)
match.players.all().delete()
match.mapfield, created = Map.objects.get_or_create(
name=match.replay.map_name,
View
17 sc2tourney/settings.py
@@ -129,6 +129,8 @@
'pagination',
'registration',
'south',
+ 'djcelery',
+ 'celery',
'profiles',
@@ -136,6 +138,14 @@
'brackets',
]
+CELERY_ALWAYS_EAGER = True
+
+#CELERY_ALWAYS_EAGER = False
+#CELERY_RESULT_BACKEND = "redis"
+#CELERY_REDIS_HOST = "localhost"
+#CELERY_REDIS_DB = 0
+#CELERY_REDIS_MAX_CONNECTIONS = 3
+
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
@@ -177,8 +187,5 @@
except ImportError:
pass
-try:
- from production_settings import *
-except ImportError:
- pass
-
+import djcelery
+djcelery.setup_loader()
View
15 sc2tourney/templates/site_base.html
@@ -2,21 +2,6 @@
{% load staticfiles %}
{% load url from future %}
-{% if DEBUG %}
- {# USE LESS IN DEBUG #}
- {% block style_base %}
- <link href="{% static "pinax/css/theme.css" %}" rel="stylesheet">
- <link href="{% static "bootstrap/less/bootstrap.less" %}" rel="stylesheet/less" type="text/css">
- <link href="{% static "bootstrap/less/responsive.less" %}" rel="stylesheet/less" type="text/css">
- {% endblock %}
-
- {% block script_base %}
- <script src="{% static "pinax/js/less-1.2.2.min.js" %}" type="text/javascript"></script>
- {{ block.super }}
- {% endblock %}
-{% endif %}
-
-
{% block head_title_base %}{% block head_title %}{% endblock %}Starcraft II Tournament{% endblock %}
{% block topbar_base %}
Please sign in to comment.
Something went wrong with that request. Please try again.