From 9decbd2ffdf6d55cdc0ddb98727a1f8c6f88e588 Mon Sep 17 00:00:00 2001 From: raylu Date: Wed, 12 Jun 2013 19:12:30 -0700 Subject: run fcgi (not dotcloud), django 1.5 also, fix link on submit.html page --- .gitignore | 1 + dotcloud.yml | 2 -- postinstall | 2 -- pyc/settings.py | 12 +++--------- pyc/templates/base.html | 10 +++++----- pyc/templates/submit.html | 2 +- run.sh | 3 +++ wsgi.py | 12 ------------ 8 files changed, 13 insertions(+), 31 deletions(-) delete mode 100644 dotcloud.yml create mode 100755 run.sh delete mode 100644 wsgi.py diff --git a/.gitignore b/.gitignore index 0f536a1..36810f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc pyc/pyc.db static/admin +submissions/ diff --git a/dotcloud.yml b/dotcloud.yml deleted file mode 100644 index 4ded94c..0000000 --- a/dotcloud.yml +++ /dev/null @@ -1,2 +0,0 @@ -www: - type: python diff --git a/postinstall b/postinstall index 3132c08..b2da452 100755 --- a/postinstall +++ b/postinstall @@ -1,7 +1,5 @@ #!/usr/bin/env python -# http://docs.dotcloud.com/tutorials/django/#static-files-and-admin-media - import os os.environ['DJANGO_SETTINGS_MODULE'] = 'pyc.settings' import django.contrib.admin diff --git a/pyc/settings.py b/pyc/settings.py index 4cef68b..bf15813 100644 --- a/pyc/settings.py +++ b/pyc/settings.py @@ -1,4 +1,4 @@ -# Django settings for pyc project. +from os import path DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -12,7 +12,7 @@ MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3', 'oracle' - 'NAME': None, + 'NAME': path.join(path.dirname(__file__), 'pyc.db'), 'USER': '', 'PASSWORD': '', 'HOST': '', @@ -20,12 +20,6 @@ DATABASES = { } } -from os import path -if path.exists('/home/dotcloud'): - DATABASES['default']['NAME'] = '/home/dotcloud/pyc.db' -else: - DATABASES['default']['NAME'] = 'pyc.db' - # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. @@ -51,7 +45,7 @@ USE_L10N = True # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = path.expanduser('~/submissions') +MEDIA_ROOT = path.join(path.dirname(__file__), '..', 'submissions') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. diff --git a/pyc/templates/base.html b/pyc/templates/base.html index 857e9c6..ff533c3 100644 --- a/pyc/templates/base.html +++ b/pyc/templates/base.html @@ -15,7 +15,7 @@ {% load cache %} {% cache 30 nav %} {% endcache %} diff --git a/pyc/templates/submit.html b/pyc/templates/submit.html index 4b76ff7..c02fac5 100644 --- a/pyc/templates/submit.html +++ b/pyc/templates/submit.html @@ -19,6 +19,6 @@

-Back to rankings +Back to rankings

{% endblock %} diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..f8d7b57 --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +cd pyc +sudo -u www-data PYTHONPATH=/var/www/pyc.raylu.net:/var/www/pyc.raylu.net/pyc:/var/www/pyc.raylu.net/submissions DJANGO_SETTINGS_MODULE=pyc.settings django-admin runfcgi socket=/var/run/lighttpd/wsgi.socket method=threaded diff --git a/wsgi.py b/wsgi.py deleted file mode 100644 index a00e126..0000000 --- a/wsgi.py +++ /dev/null @@ -1,12 +0,0 @@ -import os, sys - -os.environ['DJANGO_SETTINGS_MODULE'] = 'pyc.settings' -sys.path.append('/home/dotcloud/current/pyc') - -import django.core.handlers.wsgi -djangoapplication = django.core.handlers.wsgi.WSGIHandler() - -def application(environ, start_response): - if 'SCRIPT_NAME' in environ: - del environ['SCRIPT_NAME'] - return djangoapplication(environ, start_response) -- cgit v1.2.3