From: Radek Czajka Date: Fri, 29 Mar 2013 12:18:41 +0000 (+0100) Subject: Move manage.py to root. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/640e6f5c1e85d05d728cd29a129df9ea8aa8f31f?ds=sidebyside;hp=--cc Move manage.py to root. --- 640e6f5c1e85d05d728cd29a129df9ea8aa8f31f diff --git a/manage.py b/manage.py new file mode 100755 index 000000000..a03a13a7c --- /dev/null +++ b/manage.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +import os +import sys + +ROOT = os.path.dirname(os.path.abspath(__file__)) +sys.path = [ + os.path.join(ROOT, 'apps'), + os.path.join(ROOT, 'lib'), + os.path.join(ROOT, 'lib/librarian'), +] + sys.path + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wolnelektury.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/wolnelektury/manage.py b/wolnelektury/manage.py deleted file mode 100755 index 309a56e04..000000000 --- a/wolnelektury/manage.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -import os.path -import sys - -ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -# Add apps and lib directories to PYTHONPATH -sys.path = [ - os.path.join(ROOT, 'apps'), - os.path.join(ROOT, 'lib'), - os.path.join(ROOT, 'lib/librarian'), -] + sys.path - -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/wolnelektury/settings/__init__.py b/wolnelektury/settings/__init__.py index e8a56071f..335b2b1aa 100644 --- a/wolnelektury/settings/__init__.py +++ b/wolnelektury/settings/__init__.py @@ -2,14 +2,14 @@ # Django settings for wolnelektury project. from os import path -from settings.basic import * -from settings.auth import * -from settings.cache import * -from settings.celery import * -from settings.contrib import * -from settings.custom import * -from settings.locale import * -from settings.static import * +from .basic import * +from .auth import * +from .cache import * +from .celery import * +from .contrib import * +from .custom import * +from .locale import * +from .static import * TEMPLATE_CONTEXT_PROCESSORS = ( @@ -107,7 +107,6 @@ INSTALLED_APPS = INSTALLED_APPS_OUR + INSTALLED_APPS_CONTRIB # Load localsettings, if they exist try: - from localsettings import * + from wolnelektury.localsettings import * except ImportError: pass - diff --git a/wolnelektury/settings/basic.py b/wolnelektury/settings/basic.py index dea4b4263..6ceed8ded 100644 --- a/wolnelektury/settings/basic.py +++ b/wolnelektury/settings/basic.py @@ -1,5 +1,5 @@ from os import path -from settings.paths import PROJECT_DIR +from .paths import PROJECT_DIR DEBUG = False TEMPLATE_DEBUG = DEBUG diff --git a/wolnelektury/settings/cache.py b/wolnelektury/settings/cache.py index 61d3bb5c0..14edd53df 100644 --- a/wolnelektury/settings/cache.py +++ b/wolnelektury/settings/cache.py @@ -1,5 +1,5 @@ from os import path -from settings.paths import PROJECT_DIR +from .paths import PROJECT_DIR CACHES = { 'default': { diff --git a/wolnelektury/settings/locale.py b/wolnelektury/settings/locale.py index 121814a8d..7b951fbc9 100644 --- a/wolnelektury/settings/locale.py +++ b/wolnelektury/settings/locale.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from os import path -from settings.paths import PROJECT_DIR +from .paths import PROJECT_DIR # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. diff --git a/wolnelektury/settings/static.py b/wolnelektury/settings/static.py index 77be4d617..4e104c4e7 100644 --- a/wolnelektury/settings/static.py +++ b/wolnelektury/settings/static.py @@ -1,5 +1,5 @@ from os import path -from settings.paths import PROJECT_DIR +from .paths import PROJECT_DIR # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/"