Skip to content

Commit 77637b5

Browse files
committed
Updates to example project to run on a demo server.
1 parent a421089 commit 77637b5

File tree

8 files changed

+31
-47
lines changed

8 files changed

+31
-47
lines changed

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn example.wsgi --log-file=-

example/db.sqlite3

46 KB
Binary file not shown.

example/example/settings.py

+12-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
# Django settings for example project.
2-
import json
32
import os
3+
import dj_database_url
4+
45

56
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
67

7-
DEBUG = True
8+
DEBUG = os.environ.get('DEBUG', 'on') == 'on'
9+
810
TEMPLATE_DEBUG = DEBUG
911

12+
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(';')
13+
1014
DATABASES = {
11-
'default': {
12-
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
13-
'NAME': 'allaccess', # Or path to database file if using sqlite3.
14-
'USER': '', # Not used with sqlite3.
15-
'PASSWORD': '', # Not used with sqlite3.
16-
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
17-
'PORT': '', # Set to empty string for default. Not used with sqlite3.
18-
}
15+
'default': dj_database_url.config(default='postgres:///allaccess'),
1916
}
2017

2118
# Local time zone for this installation. Choices can be found here:
@@ -25,7 +22,7 @@
2522
# timezone as the operating system.
2623
# If running in a Windows environment this must be set to the same as your
2724
# system time zone.
28-
TIME_ZONE = 'America/Chicago'
25+
TIME_ZONE = 'UTC'
2926

3027
# Language code for this installation. All choices can be found here:
3128
# http://www.i18nguy.com/unicode/language-identifiers.html
@@ -55,7 +52,7 @@
5552
# Don't put anything in this directory yourself; store your static files
5653
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
5754
# Example: "/home/media/media.lawrence.com/static/"
58-
STATIC_ROOT = ''
55+
STATIC_ROOT = os.path.join(BASE_DIR, os.pardir, 'static')
5956

6057
# URL prefix for static files.
6158
# Example: "http://media.lawrence.com/static/"
@@ -69,16 +66,10 @@
6966
os.path.join(BASE_DIR, 'static'),
7067
)
7168

72-
# List of finder classes that know how to find static files in
73-
# various locations.
74-
STATICFILES_FINDERS = (
75-
'django.contrib.staticfiles.finders.FileSystemFinder',
76-
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
77-
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
78-
)
79-
8069
# Make this unique, and don't share it with anybody.
81-
SECRET_KEY = '&k9%jt6ozi$7o+xalyhx9=^e6+*mtb*s9)crr9mhp=ti8utykl'
70+
DEFAULT_SECRET_KEY = '&k9%jt6ozi$7o+xalyhx9=^e6+*mtb*s9)crr9mhp=ti8utykl'
71+
72+
SECRET_KEY = os.environ.get('SECRET_KEY', DEFAULT_SECRET_KEY)
8273

8374

8475
MIDDLEWARE_CLASSES = (

example/example/urls.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
1-
from django.conf.urls import patterns, include, url
2-
3-
# Uncomment the next two lines to enable the admin:
1+
from django.conf.urls import include, url
42
from django.contrib import admin
5-
admin.autodiscover()
63

74
from .views import home
85

96

10-
urlpatterns = patterns('',
11-
# Examples:
12-
# url(r'^$', 'example.views.home', name='home'),
13-
# url(r'^example/', include('example.foo.urls')),
14-
15-
# Uncomment the admin/doc line below to enable admin documentation:
16-
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
17-
18-
# Uncomment the next line to enable the admin:
7+
urlpatterns = [
198
url(r'^admin/', include(admin.site.urls)),
209
url(r'^accounts/', include('allaccess.urls')),
2110
url(r'^logout/$', 'django.contrib.auth.views.logout_then_login', name='logout'),
2211
url(r'^$', home, name='home'),
23-
)
12+
]

example/requirements.txt

-4
This file was deleted.

example/templates/home.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% load url from future %}
1+
{% load staticfiles %}
22
<!DOCTYPE html>
33
<html lang="en" class="no-js">
44
<head>
@@ -8,7 +8,7 @@
88
<meta name="description" content="{% block meta-description %}{% endblock %}">
99
<meta name="author" content="{% block meta-author %}{% endblock %}">
1010
<meta name="keywords" content="{% block meta-keywords %}{% endblock %}">
11-
<link rel="stylesheet" href="{{ STATIC_URL }}css/site.css">
11+
<link rel="stylesheet" href="{% static 'css/site.css' %}">
1212
</head>
1313
<body id="{% block body-id %}body{% endblock %}" class="{% block body-class %}body{% endblock %}">
1414
<div class="main">
@@ -34,7 +34,5 @@ <h2 class="heading">django-all-access Demo</h2>
3434
{% endif %}
3535
</div>
3636
<a href="https://github.com/mlavin/django-all-access"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
37-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
38-
{% block extra-js %}{% endblock %}
3937
</body>
4038
</html>

example/wsgi.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
# file. This includes Django's development server, if the WSGI_APPLICATION
2222
# setting points here.
2323
from django.core.wsgi import get_wsgi_application
24-
application = get_wsgi_application()
24+
from dj_static import Cling
2525

26-
# Apply WSGI middleware here.
27-
# from helloworld.wsgi import HelloWorldApplication
28-
# application = HelloWorldApplication(application)
26+
application = Cling(get_wsgi_application())

requirements.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Deployment requirements
2+
django-all-access==0.7
3+
requests-oauthlib==0.4.2
4+
requests==2.4.3
5+
oauthlib==0.7.2
6+
Django==1.7.1
7+
gunicorn>=19.1,<19.2
8+
dj-database-url==0.3.0
9+
dj-static==0.0.6
10+
static3==0.5.1
11+
psycopg2==2.5.4

0 commit comments

Comments
 (0)