Skip to content

Commit 32a9519

Browse files
committed
Django now working on Vagrant sandbox site
1 parent b96ebf2 commit 32a9519

File tree

8 files changed

+225
-7
lines changed

8 files changed

+225
-7
lines changed

Vagrantfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# vi: set ft=ruby :
33

44
Vagrant::Config.run do |config|
5-
config.vm.box = "precise64"
6-
config.vm.provision :puppet do |puppet|
7-
puppet.manifests_path = "sandbox/puppet/manifests"
8-
puppet.manifest_file = "default.pp"
9-
puppet.module_path = "sandbox/puppet/modules"
10-
end
5+
config.vm.box = "precise64"
6+
config.vm.forward_port 8000, 8080
7+
config.vm.provision :puppet do |puppet|
8+
puppet.manifests_path = "sandbox/puppet/manifests"
9+
puppet.manifest_file = "default.pp"
10+
puppet.module_path = "sandbox/puppet/modules"
11+
end
1112
end

makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
puppet:
2-
puppet module install --target-dir sandbox/puppet/modules/ puppetlabs-rabbitmq -v 2.0.1
2+
puppet module install --target-dir sandbox/puppet/modules/ puppetlabs-rabbitmq -v 2.0.1
3+
git clone git://github.com/uggedal/puppet-module-python.git sandbox/puppet/modules/python

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Django==1.4
2+
django-debug-toolbar==0.9.4

sandbox/manage.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
7+
8+
from django.core.management import execute_from_command_line
9+
10+
execute_from_command_line(sys.argv)

sandbox/puppet/manifests/default.pp

+11
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@
1212
read_permission => ".*",
1313
write_permission => ".*",
1414
provider => "rabbitmqctl"
15+
}
16+
17+
include python::dev
18+
include python::venv
19+
python::venv::isolate { "/var/www/virtualenv":
20+
requirements => "/vagrant/requirements.txt"
21+
}
22+
23+
# Set default path for all Exec tasks
24+
Exec {
25+
path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
1526
}

sandbox/settings.py

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
DEBUG = True
2+
TEMPLATE_DEBUG = DEBUG
3+
4+
ADMINS = (
5+
# ('Your Name', '[email protected]'),
6+
)
7+
8+
MANAGERS = ADMINS
9+
10+
DATABASES = {
11+
'default': {
12+
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
13+
'NAME': 'db.sqlite3', # 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+
}
19+
}
20+
21+
# Local time zone for this installation. Choices can be found here:
22+
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
23+
# although not all choices may be available on all operating systems.
24+
# On Unix systems, a value of None will cause Django to use the same
25+
# timezone as the operating system.
26+
# If running in a Windows environment this must be set to the same as your
27+
# system time zone.
28+
TIME_ZONE = 'America/Chicago'
29+
30+
# Language code for this installation. All choices can be found here:
31+
# http://www.i18nguy.com/unicode/language-identifiers.html
32+
LANGUAGE_CODE = 'en-us'
33+
34+
SITE_ID = 1
35+
36+
# If you set this to False, Django will make some optimizations so as not
37+
# to load the internationalization machinery.
38+
USE_I18N = True
39+
40+
# If you set this to False, Django will not format dates, numbers and
41+
# calendars according to the current locale.
42+
USE_L10N = True
43+
44+
# If you set this to False, Django will not use timezone-aware datetimes.
45+
USE_TZ = True
46+
47+
# Absolute filesystem path to the directory that will hold user-uploaded files.
48+
# Example: "/home/media/media.lawrence.com/media/"
49+
MEDIA_ROOT = ''
50+
51+
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
52+
# trailing slash.
53+
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
54+
MEDIA_URL = ''
55+
56+
# Absolute path to the directory static files should be collected to.
57+
# Don't put anything in this directory yourself; store your static files
58+
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
59+
# Example: "/home/media/media.lawrence.com/static/"
60+
STATIC_ROOT = ''
61+
62+
# URL prefix for static files.
63+
# Example: "http://media.lawrence.com/static/"
64+
STATIC_URL = '/static/'
65+
66+
# Additional locations of static files
67+
STATICFILES_DIRS = (
68+
# Put strings here, like "/home/html/static" or "C:/www/django/static".
69+
# Always use forward slashes, even on Windows.
70+
# Don't forget to use absolute paths, not relative paths.
71+
)
72+
73+
# List of finder classes that know how to find static files in
74+
# various locations.
75+
STATICFILES_FINDERS = (
76+
'django.contrib.staticfiles.finders.FileSystemFinder',
77+
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
78+
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
79+
)
80+
81+
# Make this unique, and don't share it with anybody.
82+
SECRET_KEY = 'a5my98-t4si@aoegk1tm4!3w3&vmsehkpez+5xp@b0kvk42t#b'
83+
84+
# List of callables that know how to import templates from various sources.
85+
TEMPLATE_LOADERS = (
86+
'django.template.loaders.filesystem.Loader',
87+
'django.template.loaders.app_directories.Loader',
88+
# 'django.template.loaders.eggs.Loader',
89+
)
90+
91+
MIDDLEWARE_CLASSES = (
92+
'django.middleware.common.CommonMiddleware',
93+
'django.contrib.sessions.middleware.SessionMiddleware',
94+
'django.middleware.csrf.CsrfViewMiddleware',
95+
'django.contrib.auth.middleware.AuthenticationMiddleware',
96+
'django.contrib.messages.middleware.MessageMiddleware',
97+
# Uncomment the next line for simple clickjacking protection:
98+
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
99+
)
100+
101+
ROOT_URLCONF = 'urls'
102+
103+
# Python dotted path to the WSGI application used by Django's runserver.
104+
WSGI_APPLICATION = 'wsgi.application'
105+
106+
TEMPLATE_DIRS = (
107+
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
108+
# Always use forward slashes, even on Windows.
109+
# Don't forget to use absolute paths, not relative paths.
110+
)
111+
112+
INSTALLED_APPS = (
113+
'django.contrib.auth',
114+
'django.contrib.contenttypes',
115+
'django.contrib.sessions',
116+
'django.contrib.sites',
117+
'django.contrib.messages',
118+
'django.contrib.staticfiles',
119+
# Uncomment the next line to enable the admin:
120+
# 'django.contrib.admin',
121+
# Uncomment the next line to enable admin documentation:
122+
# 'django.contrib.admindocs',
123+
)
124+
125+
# A sample logging configuration. The only tangible logging
126+
# performed by this configuration is to send an email to
127+
# the site admins on every HTTP 500 error when DEBUG=False.
128+
# See http://docs.djangoproject.com/en/dev/topics/logging for
129+
# more details on how to customize your logging configuration.
130+
LOGGING = {
131+
'version': 1,
132+
'disable_existing_loggers': False,
133+
'filters': {
134+
'require_debug_false': {
135+
'()': 'django.utils.log.RequireDebugFalse'
136+
}
137+
},
138+
'handlers': {
139+
'mail_admins': {
140+
'level': 'ERROR',
141+
'filters': ['require_debug_false'],
142+
'class': 'django.utils.log.AdminEmailHandler'
143+
}
144+
},
145+
'loggers': {
146+
'django.request': {
147+
'handlers': ['mail_admins'],
148+
'level': 'ERROR',
149+
'propagate': True,
150+
},
151+
}
152+
}

sandbox/urls.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from django.conf.urls import patterns, include, url
2+
3+
urlpatterns = patterns('',
4+
# Examples:
5+
# url(r'^$', 'sss.views.home', name='home'),
6+
# url(r'^sss/', include('sss.foo.urls')),
7+
8+
# Uncomment the admin/doc line below to enable admin documentation:
9+
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
10+
11+
# Uncomment the next line to enable the admin:
12+
# url(r'^admin/', include(admin.site.urls)),
13+
)

sandbox/wsgi.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
WSGI config for sss project.
3+
4+
This module contains the WSGI application used by Django's development server
5+
and any production WSGI deployments. It should expose a module-level variable
6+
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7+
this application via the ``WSGI_APPLICATION`` setting.
8+
9+
Usually you will have the standard Django WSGI application here, but it also
10+
might make sense to replace the whole Django WSGI application with a custom one
11+
that later delegates to the Django one. For example, you could introduce WSGI
12+
middleware here, or combine a Django application with an application of another
13+
framework.
14+
15+
"""
16+
import os
17+
18+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sss.settings")
19+
20+
# This application object is used by any WSGI server configured to use this
21+
# file. This includes Django's development server, if the WSGI_APPLICATION
22+
# setting points here.
23+
from django.core.wsgi import get_wsgi_application
24+
application = get_wsgi_application()
25+
26+
# Apply WSGI middleware here.
27+
# from helloworld.wsgi import HelloWorldApplication
28+
# application = HelloWorldApplication(application)

0 commit comments

Comments
 (0)