Created
November 12, 2010 16:29
-
-
Save adamn/674303 to your computer and use it in GitHub Desktop.
Example manage.py file for using a settings/ directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from os.path import abspath, dirname, join | |
from django.core.management import execute_manager | |
try: | |
from settings import active as settings | |
except ImportError: | |
sys.stderr.write("Error: Can't find the module 'active' in the directory containing %r. \ | |
(If the file settings.py does exist, it's causing an ImportError.)\n" % __file__) | |
try: | |
from settings import development as settings | |
except: | |
sys.stderr.write("Error: Can't find the module 'development' in the directory containing %r. \ | |
(If the file settings.py does exist, it's causing an ImportError.)\n" % __file__) | |
sys.exit(1) | |
sys.path.insert(0, abspath(join(dirname(__file__), "../"))) | |
sys.path.insert(0, join(settings.PROJECT_ROOT, "apps")) | |
if __name__ == "__main__": | |
execute_manager(settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
from os.path import abspath, dirname, join | |
sys.stdout = sys.stderr | |
sys.path.insert(0, abspath(join(dirname(__file__), "../"))) | |
sys.path.insert(0, abspath(join(dirname(__file__), "../../"))) | |
sys.path.insert(0, abspath(join(dirname(__file__), "../apps"))) | |
os.environ["DJANGO_SETTINGS_MODULE"] = "settings.production" | |
os.environ["CELERY_LOADER"] = "django" | |
from django.core.handlers.wsgi import WSGIHandler | |
application = WSGIHandler() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment