Move files and directories for new project layout
authorMagnus Hagander <magnus@hagander.net>
Wed, 27 Apr 2016 17:42:49 +0000 (19:42 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sat, 14 May 2016 17:49:12 +0000 (19:49 +0200)
Move manage.py up one step, set up a new wsgi.py file, and adjust
relative paths that refer to other directories for the new project
layout that we need to use in django 1.8.

manage.py [new file with mode: 0755]
pgweb/core/views.py
pgweb/manage.py [deleted file]
pgweb/settings.py
pgweb/util/contexts.py
pgweb/wsgi.py [new file with mode: 0644]

diff --git a/manage.py b/manage.py
new file mode 100755 (executable)
index 0000000..985c7e8
--- /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)
index 2317a206d78a89993bf8b383e5557af7dd2350a6..fb2a9396a9026936a4ff170b5bd104ff9bc64518 100644 (file)
@@ -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 (executable)
index 5e78ea9..0000000
+++ /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)
index 67da6e70b24f7b2de42d358e9097cc8932077585..d100520567eeeec8646b1ca3690eb34e9d6b9cad 100644 (file)
@@ -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 = (
index 2791147824a87e5169d34341f2b6300f7fc74c4f..e18baad51c8ce594de658733e0a9e9a9d1bbb87c 100644 (file)
@@ -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 (file)
index 0000000..d8c0848
--- /dev/null
@@ -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()