Skip to content

Instantly share code, notes, and snippets.

@joshsimmons
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshsimmons/b2ef119fabfb420b4ac9 to your computer and use it in GitHub Desktop.
Save joshsimmons/b2ef119fabfb420b4ac9 to your computer and use it in GitHub Desktop.
ServerName bits.opensource.pub
WSGIScriptAlias / /vagrant_data/bit-monster/bit_monster/wsgi.py
WSGIPythonPath /vagrant_data/bit-monster/bit_monster:/vagrant_data/bit-monster/venv/lib/python3.4/site-packages
<Directory /vagrant_data/bit-monster/bit_monster>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /robots.txt /vagrant_data/bit-monster/static/robots.txt
Alias /favicon.ico /vagrant_data/bit-monster/static/favicon.ico
Alias /static/ /vagrant_data/bit-monster/static/
Alias /media/ /vagrant_data/bit-monster/media/
<Directory /vagrant_data/bit-monster/static>
Require all granted
</Directory>
<Directory /vagrant_data/bit-monster/media>
Require all granted
</Directory>
WSGIDaemonProcess opensource.pub processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup opensource.pub
(venv)vagrant@vagrant-ubuntu-trusty-64:/vagrant_data/bit-monster$ sudo tail /var/log/apache2/error.log
[Sat Dec 13 08:28:52.996781 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] django.setup()
[Sat Dec 13 08:28:52.996893 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 20, in setup
[Sat Dec 13 08:28:52.996899 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Sat Dec 13 08:28:52.996921 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 46, in __getattr__
[Sat Dec 13 08:28:52.996924 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] self._setup(name)
[Sat Dec 13 08:28:52.996937 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 42, in _setup
[Sat Dec 13 08:28:52.996948 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] self._wrapped = Settings(settings_module)
[Sat Dec 13 08:28:52.996962 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 98, in __init__
[Sat Dec 13 08:28:52.996965 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] % (self.SETTINGS_MODULE, e)
[Sat Dec 13 08:28:52.996983 2014] [:error] [pid 29099:tid 140420913489664] [remote 10.0.2.2:57680] ImportError: Could not import settings 'bit_monster.settings.production' (Is it on sys.path? Is there an import error in the settings file?): No module named 'bit_monster'
import os
gettext_noop = lambda s: s
PROJECT_APP_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJECT_ROOT = os.path.abspath(os.path.dirname(PROJECT_APP_ROOT))
PUBLIC_ROOT = os.path.abspath(os.path.join(PROJECT_ROOT, 'public'))
SECRET_KEY = os.environ.get('SECRET_KEY', os.urandom(32))
DEBUG = True
TEMPLATE_DEBUG = False
SITE_ID = 1
ALLOWED_HOSTS = (
'localhost',
)
ADMINS = (
('Josh Simmons', 'jrsimmons@oreilly.com'),
)
MANAGERS = ADMINS
# Application definition
ROOT_URLCONF = 'bit_monster.urls'
WSGI_APPLICATION = 'bit_monster.wsgi.application'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# '{{ project_name}}.apps.accounts',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
# Templates
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.request',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages',
)
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, 'templates'),
)
# Database
# Internationalization
LANGUAGE_CODE = 'en-us'
LANGUAGES = (
'en', gettext_noop('English'),
)
TIME_ZONE = 'America/Los_Angeles'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCALE_PATHS = os.path.join(PROJECT_ROOT, 'locale')
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
# Logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
}
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'django.utils.log.NullHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'filters': ['require_debug_false'],
'include_html': True,
}
},
'loggers': {
'django': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False,
},
'django.db.backends': {
'handlers': ['null'],
'level': 'DEBUG',
},
'py.warnings': {
'handlers': ['null'],
'level': 'WARNING',
'propagate': False,
}
}
}
import os
import sys
sys.path.append('/vagrant_data/bit-monster/bit_monster')
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"bit_monster.settings.production")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment