Skip to content

Commit 859a0e4

Browse files
committed
initial commit
0 parents  commit 859a0e4

17 files changed

+440
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__

manage.py-tpl

Lines changed: 10 additions & 0 deletions
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("{{ project_name }}", "festi.settings")
7+
8+
from django.core.management import execute_from_command_line
9+
10+
execute_from_command_line(sys.argv)
936 KB
Binary file not shown.
961 KB
Binary file not shown.

project_name/__init__.py

Whitespace-only changes.

project_name/settings.py-tpl

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
"""
2+
Django settings for {{ project_name }} project.
3+
4+
Generated by 'django-admin startproject' using Django 1.9.4.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.9/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/1.9/ref/settings/
11+
"""
12+
13+
import os
14+
15+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = 'g^a!a^h%($0xo&tedq@x4k5(n6*5^5pc-dfnu6-^sld5@=7_b('
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
]
41+
42+
MIDDLEWARE_CLASSES = [
43+
'django.middleware.security.SecurityMiddleware',
44+
'django.contrib.sessions.middleware.SessionMiddleware',
45+
'django.middleware.common.CommonMiddleware',
46+
'django.middleware.csrf.CsrfViewMiddleware',
47+
'django.contrib.auth.middleware.AuthenticationMiddleware',
48+
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
51+
]
52+
53+
ROOT_URLCONF = '{{ project_name }}.urls'
54+
55+
TEMPLATES = [
56+
{
57+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
58+
'DIRS': [],
59+
'APP_DIRS': True,
60+
'OPTIONS': {
61+
'context_processors': [
62+
'django.template.context_processors.debug',
63+
'django.template.context_processors.request',
64+
'django.contrib.auth.context_processors.auth',
65+
'django.contrib.messages.context_processors.messages',
66+
],
67+
},
68+
},
69+
]
70+
71+
WSGI_APPLICATION = '{{ project_name }}.wsgi.application'
72+
73+
74+
# Database
75+
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
76+
77+
DATABASES = {
78+
'default': {
79+
'ENGINE': 'django.db.backends.sqlite3',
80+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
81+
}
82+
}
83+
84+
85+
# Password validation
86+
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
87+
88+
AUTH_PASSWORD_VALIDATORS = [
89+
{
90+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
91+
},
92+
{
93+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
94+
},
95+
{
96+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
97+
},
98+
{
99+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
100+
},
101+
]
102+
103+
104+
# Internationalization
105+
# https://docs.djangoproject.com/en/1.9/topics/i18n/
106+
107+
LANGUAGE_CODE = 'en-us'
108+
109+
TIME_ZONE = 'UTC'
110+
111+
USE_I18N = True
112+
113+
USE_L10N = True
114+
115+
USE_TZ = True
116+
117+
118+
# Static files (CSS, JavaScript, Images)
119+
# https://docs.djangoproject.com/en/1.9/howto/static-files/
120+
121+
STATIC_URL = '/static/'

project_name/urls.py-tpl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""{{ project_name }} URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/1.9/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.conf.urls import url, include
14+
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15+
"""
16+
from django.conf.urls import url
17+
from django.contrib import admin
18+
19+
urlpatterns = [
20+
url(r'^admin/', admin.site.urls),
21+
]

project_name/wsgi.py-tpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for {{ project_name }} project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
15+
16+
application = get_wsgi_application()

ptvs_virtualenv_proxy.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
 # ############################################################################
2+
#
3+
# Copyright (c) Microsoft Corporation.
4+
#
5+
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
6+
# copy of the license can be found in the License.html file at the root of this distribution. If
7+
# you cannot locate the Apache License, Version 2.0, please send an email to
8+
# [email protected]. By using this source code in any fashion, you are agreeing to be bound
9+
# by the terms of the Apache License, Version 2.0.
10+
#
11+
# You must not remove this notice, or any other, from this software.
12+
#
13+
# ###########################################################################
14+
15+
import datetime
16+
import os
17+
import sys
18+
19+
if sys.version_info[0] == 3:
20+
def to_str(value):
21+
return value.decode(sys.getfilesystemencoding())
22+
23+
def execfile(path, global_dict):
24+
"""Execute a file"""
25+
with open(path, 'r') as f:
26+
code = f.read()
27+
code = code.replace('\r\n', '\n') + '\n'
28+
exec(code, global_dict)
29+
else:
30+
def to_str(value):
31+
return value.encode(sys.getfilesystemencoding())
32+
33+
def log(txt):
34+
"""Logs fatal errors to a log file if WSGI_LOG env var is defined"""
35+
log_file = os.environ.get('WSGI_LOG')
36+
if log_file:
37+
f = open(log_file, 'a+')
38+
try:
39+
f.write('%s: %s' % (datetime.datetime.now(), txt))
40+
finally:
41+
f.close()
42+
43+
ptvsd_secret = os.getenv('WSGI_PTVSD_SECRET')
44+
if ptvsd_secret:
45+
log('Enabling ptvsd ...\n')
46+
try:
47+
import ptvsd
48+
try:
49+
ptvsd.enable_attach(ptvsd_secret)
50+
log('ptvsd enabled.\n')
51+
except:
52+
log('ptvsd.enable_attach failed\n')
53+
except ImportError:
54+
log('error importing ptvsd.\n');
55+
56+
def get_wsgi_handler(handler_name):
57+
if not handler_name:
58+
raise Exception('WSGI_HANDLER env var must be set')
59+
60+
if not isinstance(handler_name, str):
61+
handler_name = to_str(handler_name)
62+
63+
module_name, _, callable_name = handler_name.rpartition('.')
64+
should_call = callable_name.endswith('()')
65+
callable_name = callable_name[:-2] if should_call else callable_name
66+
name_list = [(callable_name, should_call)]
67+
handler = None
68+
69+
while module_name:
70+
try:
71+
handler = __import__(module_name, fromlist=[name_list[0][0]])
72+
for name, should_call in name_list:
73+
handler = getattr(handler, name)
74+
if should_call:
75+
handler = handler()
76+
break
77+
except ImportError:
78+
module_name, _, callable_name = module_name.rpartition('.')
79+
should_call = callable_name.endswith('()')
80+
callable_name = callable_name[:-2] if should_call else callable_name
81+
name_list.insert(0, (callable_name, should_call))
82+
handler = None
83+
84+
if handler is None:
85+
raise ValueError('"%s" could not be imported' % handler_name)
86+
87+
return handler
88+
89+
activate_this = os.getenv('WSGI_ALT_VIRTUALENV_ACTIVATE_THIS')
90+
if not activate_this:
91+
raise Exception('WSGI_ALT_VIRTUALENV_ACTIVATE_THIS is not set')
92+
93+
def get_virtualenv_handler():
94+
log('Activating virtualenv with %s\n' % activate_this)
95+
execfile(activate_this, dict(__file__=activate_this))
96+
97+
log('Getting handler %s\n' % os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
98+
handler = get_wsgi_handler(os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
99+
log('Got handler: %r\n' % handler)
100+
return handler
101+
102+
def get_venv_handler():
103+
log('Activating venv with executable at %s\n' % activate_this)
104+
import site
105+
sys.executable = activate_this
106+
old_sys_path, sys.path = sys.path, []
107+
108+
site.main()
109+
110+
sys.path.insert(0, '')
111+
for item in old_sys_path:
112+
if item not in sys.path:
113+
sys.path.append(item)
114+
115+
log('Getting handler %s\n' % os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
116+
handler = get_wsgi_handler(os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
117+
log('Got handler: %r\n' % handler)
118+
return handler

reqs/azure_webapp.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-r common.txt
2+
packages\mysqlclient-1.3.7-cp34-none-win32.whl

0 commit comments

Comments
 (0)