Skip to content

Commit

Permalink
[Bug 567960] Add vendor library.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Socol committed Aug 24, 2010
1 parent 6975470 commit ccca0cb
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 86 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build.py
**-all.js
**-min.js
media/uploads
vendor
6 changes: 4 additions & 2 deletions configs/sphinx/localsettings_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
os.path.join(os.path.dirname(__file__), os.path.sep.join(('..',)*2)))

sys.path.append(SETTINGS_DIR)
sys.path.append(os.path.join(SETTINGS_DIR,'lib'))

import settings_local as settings
# manage adds /apps, /lib and /vendor to the Python path.
import manage

from django.conf import settings

s = settings.DATABASES['default']
MYSQL_PASS = s['PASSWORD']
Expand Down
17 changes: 15 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
#!/usr/bin/env python
import os
import site

from django.core.management import execute_manager, setup_environ
import sys


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('apps'))
site.addsitedir(path('lib'))
site.addsitedir(path('vendor'))

# Move the new items to the front of sys.path.
new_sys_path = []
for item in list(sys.path):
if item not in prev_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[:0] = new_sys_path

# Now we can import from third-party libraries.
from django.core.management import execute_manager, setup_environ

try:
import settings_local as settings
Expand Down
4 changes: 4 additions & 0 deletions requirements/compiled.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MySQL-python==1.2.3c1
Jinja2==2.2.1
PIL==1.1.7
lxml==2.2.6
15 changes: 7 additions & 8 deletions requirements-dev.txt → requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
#
# This pulls in requirements specific for development.

-r requirements.txt
-r prod.txt

-e git://github.com/jbalogh/check.git@1c73813fcd085020decc6f72caf232f71150db0a#egg=check
-e git://github.com/robhudson/django-debug-toolbar.git@d05dcbb4aa93b1ce9d097ed8d537f06eb2491f5e#egg=django_debug_toolbar
-e git://github.com/jbalogh/django-debug-cache-panel@dbdffc6048bde9e551f9bc01975ad3373b9c9427#egg=cache_panel
Werkzeug==0.5.1
ipython==0.10
sqlparse==0.1.1

-e git://github.com/jbalogh/django-nose.git@70de9dd19e40bd292cdac06c51b6bfe703731504#egg=django_nose
-e git://github.com/jbalogh/test-utils.git@c4c31905a95e59dcc8919c1030b23848ad7fbca6#egg=test-utils
nose==0.11.1
coverage==3.2b4
selenium==1.0.1
mock==0.6.0
pyquery==0.5
translate-toolkit==1.6.0

pylint==0.20.0

-e git://github.com/jbalogh/check.git@1c73813fcd085020decc6f72caf232f71150db0a#egg=check
-e git://github.com/robhudson/django-debug-toolbar.git@d05dcbb4aa93b1ce9d097ed8d537f06eb2491f5e#egg=django_debug_toolbar
-e git://github.com/jbalogh/django-debug-cache-panel@dbdffc6048bde9e551f9bc01975ad3373b9c9427#egg=cache_panel
-e git://github.com/jbalogh/django-nose.git@70de9dd19e40bd292cdac06c51b6bfe703731504#egg=django_nose
-e git://github.com/jbalogh/test-utils.git@c4c31905a95e59dcc8919c1030b23848ad7fbca6#egg=test-utils
33 changes: 9 additions & 24 deletions requirements.txt → requirements/prod.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,23 @@
-e svn+http://code.djangoproject.com/svn/django/trunk@13302#egg=Django

GitPython==0.1.7
python-memcached==1.45
Babel>=0.9.4
celery==1.0.6
python-dateutil
django-taggit==0.8.0
pytz

-e git://github.com/jbalogh/django-multidb-router.git@25ca0c68929144ed9020d89f2ea1e941c7f9aeca#egg=django-multidb-router
-e git://github.com/jbalogh/django-cache-machine.git#egg=django-cache-machine
-e git://github.com/django-extensions/django-extensions.git#egg=django_extensions
Jinja2==2.2.1
-e git://github.com/jbalogh/jingo.git#egg=jingo
-e git://github.com/jsocol/jingo-minify.git#egg=jingo-minify
-e git://github.com/jsocol/bleach.git#egg=bleach
-e git://github.com/jbalogh/schematic.git#egg=schematic
-e git://github.com/jsocol/django-cronjobs.git#egg=django_cronjobs
-e git://github.com/fwenzel/django-mozilla-product-details#egg=django-mozilla-product-details

GitPython==0.1.7
MySQL-python==1.2.3c1
python-memcached==1.45
Werkzeug==0.5.1
Babel>=0.9.4
phpserialize==1.2
South==0.7
celery==1.0.6
python-dateutil
PIL==1.1.7

# for l10n
-e git://github.com/clouserw/tower.git#egg=tower

# commonware, stuff we share
-e git://github.com/jsocol/commonware.git#egg=commonware

# timezone package used with babel
pytz

# wiki markup parser
-e git://github.com/pcraciunoiu/py-wikimarkup.git@8b19befb719526735d08f5a185cf7cd1a382e4ad#egg=py-wikimarkup

-e hg+http://bitbucket.org/danfairs/django-authority#egg=django_authority

django-taggit==0.8.0
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VENV=$WORKSPACE/venv
echo "Starting build..."

# Clean up after last time.
find . -name '*.pyc' | xargs rm
find . -name '*.pyc' -exec rm {} \;

if [ ! -d "$VENV/bin" ]; then
echo "No virtualenv found; making one..."
Expand All @@ -16,7 +16,7 @@ fi

source $VENV/bin/activate

pip install -qr requirements-dev.txt
pip install -qUr requirements/dev.txt

python manage.py update_product_details

Expand Down
79 changes: 31 additions & 48 deletions wsgi/kitsune.wsgi
Original file line number Diff line number Diff line change
@@ -1,58 +1,41 @@
import os
import site
from datetime import datetime

# Add the kitsune dir to the python path so we can import manage which sets up
# other paths and settings.
# Remember when mod_wsgi loaded this file so we can track it in nagios.
wsgi_loaded = datetime.now()

# 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, '../')))

# We let Apache tell us where to find site packages through the SITE variable
# in the wsgi environment. That means we can't import anything from django or
# kitsune until we're inside of a request, so the first time through will run
# basic imports and validates our models (which cascades to import
# <apps>.models).


class KitsuneApp:

def __init__(self):
self.setup = False

def __call__(self, env, start_response):
if not self.setup:
self.setup_app(env)
self.setup = True
return self.kitsune_app(env, start_response)

def setup_app(self, env):
if 'SITE' in env:
site.addsitedir(env['SITE'])

# manage adds the `apps` and `lib` directories to the 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
utility = django.core.management.ManagementUtility()
command = utility.fetch_command('runserver')
command.validate()
django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)

# This is what mod_wsgi runs.
self.wsgi_handler = django.core.handlers.wsgi.WSGIHandler()

def kitsune_app(self, env, start_response):
if 'HTTP_X_ZEUS_DL_PT' in env:
env['SCRIPT_URL'] = env['SCRIPT_NAME'] = ''
return self.wsgi_handler(env, start_response)
# 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
return django_app(env, start_response)

application = KitsuneApp()

# Uncomment this to figure out what's going on with the mod_wsgi environment.
# def application(env, start_response):
Expand Down

0 comments on commit ccca0cb

Please sign in to comment.