From 640e6f5c1e85d05d728cd29a129df9ea8aa8f31f Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 29 Mar 2013 13:18:41 +0100 Subject: [PATCH] Move manage.py to root. --- manage.py | 17 +++++++++++++++++ wolnelektury/manage.py | 24 ------------------------ wolnelektury/settings/__init__.py | 19 +++++++++---------- wolnelektury/settings/basic.py | 2 +- wolnelektury/settings/cache.py | 2 +- wolnelektury/settings/locale.py | 2 +- wolnelektury/settings/static.py | 2 +- 7 files changed, 30 insertions(+), 38 deletions(-) create mode 100755 manage.py delete mode 100755 wolnelektury/manage.py 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/" -- 2.20.1