summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraylu <ray.lu@getclever.com>2013-06-12 19:12:30 -0700
committerraylu <ray.lu@getclever.com>2013-06-12 19:12:30 -0700
commit9decbd2ffdf6d55cdc0ddb98727a1f8c6f88e588 (patch)
tree7e9fee33f0ea6c11cb63f7dda30f5c2dece09fa0
parent9e2a09e7254b3ad89d43c96be9229590518e9737 (diff)
downloadpyc-9decbd2ffdf6d55cdc0ddb98727a1f8c6f88e588.tar.xz
run fcgi (not dotcloud), django 1.5
also, fix link on submit.html page
-rw-r--r--.gitignore1
-rw-r--r--dotcloud.yml2
-rwxr-xr-xpostinstall2
-rw-r--r--pyc/settings.py12
-rw-r--r--pyc/templates/base.html10
-rw-r--r--pyc/templates/submit.html2
-rwxr-xr-xrun.sh3
-rw-r--r--wsgi.py12
8 files changed, 13 insertions, 31 deletions
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 %}
<div class="nav">
- <a href="{% url grader.views.index %}">Home</a>
+ <a href="{% url "grader.views.index" %}">Home</a>
<p>Labs:</p>
<ol>
@@ -24,16 +24,16 @@
{% endfor %}
</ol>
- <a href="{% url grader.views.faq %}">FAQ</a>
+ <a href="{% url "grader.views.faq" %}">FAQ</a>
</div>
{% endcache %}
<div class="nav">
{% if authenticated %}
- <a href="{% url django.contrib.auth.views.password_change %}">Change Password</a>
+ <a href="{% url "django.contrib.auth.views.password_change" %}">Change Password</a>
<br />
- <a href="{% url django.contrib.auth.views.logout %}">Logout</a>
+ <a href="{% url "django.contrib.auth.views.logout" %}">Logout</a>
{% else %}
- <a href="{% url django.contrib.auth.views.login %}">Login</a>
+ <a href="{% url "django.contrib.auth.views.login" %}">Login</a>
{% endif %}
</div>
</div>
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 @@
</p>
<p>
-<a href="/lab/{{ lab_id }}">Back</a> to rankings
+<a href="/lab/{{ lab_id }}/">Back</a> to rankings
</p>
{% 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)