summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmanage.py10
-rw-r--r--pgweb/core/views.py20
-rwxr-xr-xpgweb/manage.py11
-rw-r--r--pgweb/settings.py6
-rw-r--r--pgweb/util/contexts.py2
-rw-r--r--pgweb/wsgi.py16
6 files changed, 40 insertions, 25 deletions
diff --git a/manage.py b/manage.py
new file mode 100755
index 00000000..985c7e8f
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pgweb.settings")
+
+ from django.core.management import execute_from_command_line
+
+ execute_from_command_line(sys.argv)
diff --git a/pgweb/core/views.py b/pgweb/core/views.py
index 2317a206..fb2a9396 100644
--- a/pgweb/core/views.py
+++ b/pgweb/core/views.py
@@ -163,16 +163,16 @@ def sitemap(request):
# dynamically, since the output will be cached (for all non-SSL users, which
# is the vast majority) anyway.
_dynamic_cssmap = {
- 'base': ['../media/css/global.css',
- '../media/css/layout.css',
- '../media/css/text.css',
- '../media/css/navigation.css',
- '../media/css/table.css',
- '../media/css/iefixes.css'],
- 'docs': ['../media/css/global.css',
- '../media/css/table.css',
- '../media/css/text.css',
- '../media/css/docs.css'],
+ 'base': ['media/css/global.css',
+ 'media/css/layout.css',
+ 'media/css/text.css',
+ 'media/css/navigation.css',
+ 'media/css/table.css',
+ 'media/css/iefixes.css'],
+ 'docs': ['media/css/global.css',
+ 'media/css/table.css',
+ 'media/css/text.css',
+ 'media/css/docs.css'],
}
@ssl_optional
@cache(hours=6)
diff --git a/pgweb/manage.py b/pgweb/manage.py
deleted file mode 100755
index 5e78ea97..00000000
--- a/pgweb/manage.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-from django.core.management import execute_manager
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
- sys.exit(1)
-
-if __name__ == "__main__":
- execute_manager(settings)
diff --git a/pgweb/settings.py b/pgweb/settings.py
index 67da6e70..d1005205 100644
--- a/pgweb/settings.py
+++ b/pgweb/settings.py
@@ -44,7 +44,7 @@ MEDIA_URL = ''
STATIC_URL = '/media/'
STATICFILES_DIRS = (
- '../media/',
+ 'media/',
)
# Make this unique, and don't share it with anybody.
@@ -72,8 +72,8 @@ CSRF_FAILURE_VIEW='pgweb.core.views.csrf_failure'
ROOT_URLCONF = 'pgweb.urls'
TEMPLATE_DIRS = (
- '../templates/',
- '../../templates', # Sometimes called in subdirectories, should never hurt to have both
+ 'templates/',
+ '../templates', # Sometimes called in subdirectories, should never hurt to have both
)
TEMPLATE_CONTEXT_PROCESSORS = (
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 27911478..e18baad5 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -104,7 +104,7 @@ class NavContext(RequestContext):
def _get_gitrev():
# Return the current git revision, that is used for
# cache-busting URLs.
- with open('../.git/refs/heads/master') as f:
+ with open('.git/refs/heads/master') as f:
return f.readline()[:8]
# Template context processor to add information about the root link and
diff --git a/pgweb/wsgi.py b/pgweb/wsgi.py
new file mode 100644
index 00000000..d8c08487
--- /dev/null
+++ b/pgweb/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for pgweb project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pgweb.settings")
+
+application = get_wsgi_application()