Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgrade Django. Switch to the new project layout.

  • Loading branch information...
commit 83dcb65d5d818c5757ee2c893b788279253faf53 1 parent ccde193
@aaugustin aaugustin authored
View
3  TODO
@@ -1 +1,2 @@
-* allow users to "claim" legacy feeds (might do this by hand.)
+* allow users to "claim" legacy feeds (might do this by hand.)
+* get rid of wsgi-scripts, move useful functions to django_*.wsgi
View
2  deploy-requirements.txt
@@ -1,7 +1,7 @@
# Requirements to deploy this code.
akismet == 0.2.0
-Django >= 1.3, < 1.4
+Django >= 1.4, < 1.5
django-haystack == 1.1.0
django-push == 0.4
django-registration == 0.7
View
0  django_website/urls/__init__.py → django_docs/__init__.py
File renamed without changes
View
4 django_website/settings/docs.py → django_docs/settings.py
@@ -1,9 +1,9 @@
-from django_website.settings.www import *
+from django_www.settings import *
PREPEND_WWW = False
APPEND_SLASH = True
TEMPLATE_CONTEXT_PROCESSORS += ["django.core.context_processors.request"]
-ROOT_URLCONF = 'django_website.urls.docs'
+ROOT_URLCONF = 'django_docs.urls'
CACHE_MIDDLEWARE_KEY_PREFIX = 'djangodocs'
# Override INSTALLED_APPS so that we only have a few things running on docs.
View
7 django_website/urls/docs.py → django_docs/urls.py
@@ -1,7 +1,8 @@
from django.conf import settings
from django.conf.urls.defaults import *
from haystack.views import search_view_factory
-from ..docs import views
+
+from django_website.docs import views
urlpatterns = patterns('',
url(
@@ -54,6 +55,6 @@
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^media/(?P<path>.*)$',
- 'django.views.static.serve',
+ 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
- )
+ )
View
14 django_docs/wsgi.py
@@ -0,0 +1,14 @@
+"""
+WSGI config for django_docs project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
+"""
+
+import os
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_docs.settings")
+
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
View
0  django_website/settings/__init__.py → django_www/__init__.py
File renamed without changes
View
4 django_website/settings/www.py → django_www/settings.py
@@ -6,7 +6,7 @@
from unipath import FSPath as Path
# The full path to the django_website directory.
-BASE = Path(__file__).absolute().ancestor(2)
+BASE = Path(__file__).absolute().ancestor(2).child('django_website')
# Far too clever trick to know if we're running on the deployment server.
PRODUCTION = ('DJANGOPROJECT_DEBUG' not in os.environ) and ("djangoproject" in platform.node())
@@ -58,7 +58,7 @@
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
SITE_ID = 1
-ROOT_URLCONF = 'django_website.urls.www'
+ROOT_URLCONF = 'django_www.urls'
INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.auth',
View
8 django_website/urls/www.py → django_www/urls.py
@@ -9,10 +9,10 @@
from django.contrib.sitemaps import views as sitemap_views
from django.views.decorators.cache import cache_page
from django.views.generic.simple import redirect_to
-from ..accounts import views as account_views
-from ..aggregator.feeds import CommunityAggregatorFeed, CommunityAggregatorFirehoseFeed
-from ..blog.feeds import WeblogEntryFeed
-from ..sitemaps import FlatPageSitemap, WeblogSitemap
+from django_website.accounts import views as account_views
+from django_website.aggregator.feeds import CommunityAggregatorFeed, CommunityAggregatorFirehoseFeed
+from django_website.blog.feeds import WeblogEntryFeed
+from django_website.sitemaps import FlatPageSitemap, WeblogSitemap
admin.autodiscover()
View
14 django_www/wsgi.py
@@ -0,0 +1,14 @@
+"""
+WSGI config for django_www project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
+"""
+
+import os
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_www.settings")
+
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
View
2  fabfile.py
@@ -93,7 +93,7 @@ def managepy(cmd, site='www'):
"""
assert site in ('docs', 'www')
django_admin = env.virtualenv.child('bin', 'django-admin.py')
- sudo('%s %s --settings=django_website.settings.%s' % (django_admin, cmd, site))
+ sudo('%s %s --settings=django_%s.settings' % (django_admin, cmd, site))
def southify(app):
"""
View
20 manage.py
@@ -1,14 +1,14 @@
#!/usr/bin/env python
-
import os
import sys
-sys.path.append(os.path.abspath(os.path.dirname(__file__)))
-if '--docs' in sys.argv:
- import django_website.settings.docs as settings
- sys.argv.remove('--docs')
-else:
- import django_website.settings.www as settings
-
-from django.core.management import execute_manager
-execute_manager(settings)
+if __name__ == "__main__":
+ if '--docs' in sys.argv:
+ settings_module = 'django_docs.settings'
+ sys.argv.remove('--docs')
+ else:
+ settings_module = 'django_www.settings'
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module)
+
+ from django.core.management import execute_from_command_line
+ execute_from_command_line(sys.argv)
View
22 wsgi-scripts/docs.wsgi
@@ -1,28 +1,28 @@
import os
-import sys
-import site
+import sys
+import site
SITE_PACKAGES = '/home/www/djangoproject.com/lib/python2.6/site-packages'
# Remember original sys.path.
-prev_sys_path = list(sys.path)
+prev_sys_path = list(sys.path)
# Add each new site-packages directory.
site.addsitedir(SITE_PACKAGES)
# Reorder sys.path so new directories at the front.
-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
+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
# Bootstrap Django
here = os.path.dirname(__file__)
parent = os.path.dirname(here)
sys.path.append(parent)
-os.environ['DJANGO_SETTINGS_MODULE'] = 'django_website.settings.docs'
+os.environ['DJANGO_SETTINGS_MODULE'] = 'django_docs.settings'
import django.core.handlers.wsgi
-application = django.core.handlers.wsgi.WSGIHandler()
+application = django.core.handlers.wsgi.WSGIHandler()
View
22 wsgi-scripts/svnauth.wsgi
@@ -3,8 +3,8 @@ This file's a hack working around WSGIAuthGroupScript not working.
"""
import os
-import sys
-import site
+import sys
+import site
#
# Bootstrap
@@ -13,24 +13,24 @@ import site
SITE_PACKAGES = '/home/www/djangoproject.com/lib/python2.6/site-packages'
# Remember original sys.path.
-prev_sys_path = list(sys.path)
+prev_sys_path = list(sys.path)
# Add each new site-packages directory.
site.addsitedir(SITE_PACKAGES)
# Reorder sys.path so new directories at the front.
-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
+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
# Bootstrap Django
here = os.path.dirname(__file__)
parent = os.path.dirname(here)
sys.path.append(parent)
-os.environ['DJANGO_SETTINGS_MODULE'] = 'django_website.settings.www'
+os.environ['DJANGO_SETTINGS_MODULE'] = 'django_www.settings'
#
# WSGI auth handler
@@ -48,4 +48,4 @@ def check_password(environ, user, password):
except User.DoesNotExist:
return None
finally:
- db.connection.close()
+ db.connection.close()
View
24 wsgi-scripts/www.wsgi
@@ -1,6 +1,6 @@
import os
-import sys
-import site
+import sys
+import site
#
# Bootstrap
@@ -9,24 +9,24 @@ import site
SITE_PACKAGES = '/home/www/djangoproject.com/lib/python2.6/site-packages'
# Remember original sys.path.
-prev_sys_path = list(sys.path)
+prev_sys_path = list(sys.path)
# Add each new site-packages directory.
site.addsitedir(SITE_PACKAGES)
# Reorder sys.path so new directories at the front.
-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
+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
# Bootstrap Django
here = os.path.dirname(__file__)
parent = os.path.dirname(here)
sys.path.append(parent)
-os.environ['DJANGO_SETTINGS_MODULE'] = 'django_website.settings.www'
+os.environ['DJANGO_SETTINGS_MODULE'] = 'django_www.settings'
#
# WSGI application
@@ -50,10 +50,10 @@ def check_password(environ, user, password):
return None
finally:
db.connection.close()
-
+
def groups_for_user(environ, user):
try:
u = User.objects.get(username=user)
except User.DoesNotExist:
return []
- return [g.name.lower() for g in u.groups.all()]
+ return [g.name.lower() for g in u.groups.all()]
Please sign in to comment.
Something went wrong with that request. Please try again.