Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into production

  • Loading branch information...
commit 9befa682464f6c81c1f747ba9488ce78dd642daa 2 parents 35da706 + 4401d80
@zalun zalun authored
View
8 docs/source/installation.rst
@@ -29,7 +29,7 @@ code, substituting your name::
git clone git@github.com:{your-username}/FlightDeck.git # if you're not a developer, just use "mozilla" for your-username
cd FlightDeck
- git clone --recursive git://github.com/zalun/FlightDeck-lib.git vendor
+ git clone --recursive git://github.com/mozilla/FlightDeck-lib.git vendor
Install submodules::
@@ -98,17 +98,17 @@ An example Apache .conf::
<Location "/adminmedia">
SetHandler default
</Location>
- Alias /adminmedia /path/to/FlightDeck/flightdeck/adminmedia
+ Alias /adminmedia /path/to/FlightDeck/flightdeck/vendor/lib/python/django/contrib/admin/media
<Location "/media/tutorial">
SetHandler default
</Location>
- Alias /media/tutorial /path/to/FlightDeck/flightdeck/tutorial/media
+ Alias /media/tutorial /path/to/FlightDeck/flightdeck/apps/tutorial/media
<Location "/media/api">
SetHandler default
</Location>
- Alias /media/api /path/to/FlightDeck/flightdeck/api/media
+ Alias /media/api /path/to/FlightDeck/flightdeck/apps/api/media
<Location "/media/jetpack">
SetHandler default
View
4 manage.py
@@ -3,14 +3,14 @@
import sys
import site
-site.addsitedir('vendor')
-site.addsitedir('vendor/lib/python')
ROOT = os.path.dirname(os.path.abspath(__file__))
path = lambda *a: os.path.join(ROOT, *a)
prev_sys_path = list(sys.path)
+site.addsitedir(path('vendor'))
+site.addsitedir(path('vendor/lib/python'))
site.addsitedir(path('apps'))
site.addsitedir(path('lib'))
site.addsitedir(path('lib/jetpack-sdk-0.8/python-lib')) # weak sauce
View
5 settings.py
@@ -4,6 +4,7 @@
"""
import os
import logging
+import socket
# Make filepaths relative to settings.
ROOT = os.path.dirname(os.path.abspath(__file__))
@@ -71,6 +72,10 @@
# to load the internationalization machinery.
USE_I18N = True
+# The host currently running the site. Only use this in code for good reason;
+# the site is designed to run on a cluster and should continue to support that
+HOSTNAME = socket.gethostname()
+
# Paths settings
MEDIA_ROOT = path('media')
View
50 wsgi/flightdeck.wsgi
@@ -0,0 +1,50 @@
+import os
+import site
+from datetime import datetime
+
+# Remember when mod_wsgi loaded this file so we can track it in nagios.
+wsgi_loaded = datetime.now()
+
+# Tell celery that we're using Django.
+os.environ['CELERY_LOADER'] = 'django'
+
+# Add the zamboni dir to the python path so we can import manage.
+wsgidir = os.path.dirname(__file__)
+site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../')))
+
+# manage adds /apps, /lib, and /vendor to the Python path.
+import manage
+
+import django.conf
+import django.core.handlers.wsgi
+import django.core.management
+import django.utils
+
+# Do validate and activate translations like using `./manage.py runserver`.
+# http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
+django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)
+utility = django.core.management.ManagementUtility()
+command = utility.fetch_command('runserver')
+command.validate()
+
+# This is what mod_wsgi runs.
+django_app = django.core.handlers.wsgi.WSGIHandler()
+
+# Normally we could let WSGIHandler run directly, but while we're dark
+# launching, we want to force the script name to be empty so we don't create
+# any /z links through reverse. This fixes bug 554576.
+def application(env, start_response):
+ if 'HTTP_X_ZEUS_DL_PT' in env:
+ env['SCRIPT_URL'] = env['SCRIPT_NAME'] = ''
+ env['wsgi.loaded'] = wsgi_loaded
+ env['hostname'] = django.conf.settings.HOSTNAME
+ env['datetime'] = str(datetime.now())
+ return django_app(env, start_response)
+
+
+# Uncomment this to figure out what's going on with the mod_wsgi environment.
+# def application(env, start_response):
+# start_response('200 OK', [('Content-Type', 'text/plain')])
+# return '\n'.join('%r: %r' % item for item in sorted(env.items()))
+
+# vim: ft=python
Please sign in to comment.
Something went wrong with that request. Please try again.