Created
November 1, 2011 10:36
-
-
Save ojii/1330281 to your computer and use it in GitHub Desktop.
My scripts
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
# -*- coding: utf-8 -*- | |
# IS IN FOLDER ./src/ (github doesn't allow slashes in filenames on gists) | |
import os | |
import re | |
DEBUG = False | |
TEMPLATE_DEBUG = DEBUG | |
DEBUG_PROPAGATE_EXCEPTIONS = False | |
IS_DEV_SERVER = False | |
PREPEND_WWW = False | |
FORCE_SCRIPT_NAME = '' | |
USE_ETAGS = False | |
ADMINS = [] | |
MANAGERS = ADMINS | |
TIME_ZONE = 'Europe/Zurich' | |
LANGUAGE_CODE = 'en' | |
SITE_ID = 1 | |
USE_I18N = True | |
USE_L10N = True | |
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) | |
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media') | |
MEDIA_URL = '/media/' | |
STATIC_ROOT = os.path.join(PROJECT_DIR, '..', 'static') | |
STATIC_URL = '/static/' | |
ADMIN_MEDIA_PREFIX = '/static/admin/' | |
STATICFILES_DIRS = [ | |
os.path.join(PROJECT_DIR, 'static'), | |
] | |
TEMPLATE_LOADERS = [ | |
'django.template.loaders.filesystem.Loader', | |
'django.template.loaders.app_directories.Loader', | |
] | |
MIDDLEWARE_CLASSES = [ | |
'project.middlewares.LogbookMiddleware', | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django.contrib.messages.middleware.MessageMiddleware', | |
'django.middleware.common.CommonMiddleware', | |
'django.middleware.csrf.CsrfViewMiddleware', | |
'django.middleware.http.ConditionalGetMiddleware', | |
] | |
ROOT_URLCONF = 'project.urls' | |
TEMPLATE_DIRS = [ | |
os.path.join(PROJECT_DIR, "templates"), | |
] | |
THIRD_PARTY_APPS = [ | |
# django core apps | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.sites', | |
'django.contrib.messages', | |
'django.contrib.admin', | |
'django.contrib.staticfiles', | |
# 3rd party apps | |
'easy_thumbnails', | |
'sekizai', | |
'south', | |
'floppyforms', | |
] | |
CUSTOM_APPS = APPS_TO_TEST = [ | |
# custom apps | |
'project', | |
] | |
INSTALLED_APPS = THIRD_PARTY_APPS + CUSTOM_APPS | |
TEMPLATE_CONTEXT_PROCESSORS = [ | |
"django.contrib.auth.context_processors.auth", | |
"django.core.context_processors.i18n", | |
"django.core.context_processors.debug", | |
"django.core.context_processors.request", | |
"django.core.context_processors.media", | |
"django.core.context_processors.static", | |
"django.core.context_processors.request", | |
"django.contrib.messages.context_processors.messages", | |
'sekizai.context_processors.sekizai', | |
] |
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
# THIS IS OBVIOUSLY NOT A SCRIPT, BUT WHAT YOU WOULD TYPE IN THE SHELL | |
echo 'activate virtualenv' | |
source env/bin/activate | |
echo 'running local settings runserver' | |
src/local runserver | |
echo 'running personal runserver' | |
src/personal runserver |
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 | |
# IS IN FOLDER ./src/ (github doesn't allow slashes in filenames on gists) | |
from django.core.management import ManagementUtility | |
import os | |
if __name__ == "__main__": | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'local' | |
utility = ManagementUtility(None) | |
utility.execute() |
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
# -*- coding: utf-8 -*- | |
# IS IN FOLDER ./src/ (github doesn't allow slashes in filenames on gists) | |
from base import * | |
import debug_toolbar | |
import logging | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(PROJECT_DIR, 'database.sqlite'), | |
} | |
} | |
MIDDLEWARE_CLASSES.append('debug_toolbar.middleware.DebugToolbarMiddleware') | |
INSTALLED_APPS += [ | |
'debug_toolbar', | |
] | |
def custom_show_toolbar(request): | |
return 'debug' in request.GET or debug_toolbar.urls._PREFIX in request.path | |
DEBUG_TOOLBAR_CONFIG = { | |
'INTERCEPT_REDIRECTS': False, | |
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar, | |
} | |
logging.getLogger().setLevel(logging.INFO) |
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 | |
# IS IN FOLDER ./src/ (github doesn't allow slashes in filenames on gists) | |
from django.core.management import ManagementUtility | |
import os | |
if __name__ == "__main__": | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'personal' | |
utility = ManagementUtility(None) | |
utility.execute() |
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
# -*- coding: utf-8 -*- | |
# IS IN FOLDER ./src/ (github doesn't allow slashes in filenames on gists) | |
from local import * | |
INSTALLED_APPS += [ | |
'some_experimental_app', | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment