Skip to content

Commit 355c58e

Browse files
committed
Bringing the Django project into this repo
1 parent 518d059 commit 355c58e

File tree

6 files changed

+251
-0
lines changed

6 files changed

+251
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ nosetests.xml
3434
.mr.developer.cfg
3535
.project
3636
.pydevproject
37+
38+
# Misc
39+
scrape_game.log

manage.py

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("DJANGO_SETTINGS_MODULE", "mls_api_proj.settings")
7+
8+
from django.core.management import execute_from_command_line
9+
10+
execute_from_command_line(sys.argv)

mls_api_proj/__init__.py

Whitespace-only changes.

mls_api_proj/settings.py

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Django settings for mls_api_proj project.
2+
import os
3+
4+
PROJECT_DIR = os.path.dirname(__file__)
5+
6+
DEBUG = True
7+
TEMPLATE_DEBUG = DEBUG
8+
9+
ADMINS = (
10+
# ('Your Name', '[email protected]'),
11+
)
12+
13+
MANAGERS = ADMINS
14+
15+
DATABASES = {
16+
'default': {
17+
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
18+
'NAME': 'mls_api',# Or path to database file if using sqlite3.
19+
# The following settings are not used with sqlite3:
20+
'USER': 'mls_api',
21+
'PASSWORD': 'mls_api',
22+
'HOST': 'localhost', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
23+
'PORT': '5432', # Set to empty string for default.
24+
}
25+
}
26+
27+
# Hosts/domain names that are valid for this site; required if DEBUG is False
28+
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
29+
ALLOWED_HOSTS = []
30+
31+
# Local time zone for this installation. Choices can be found here:
32+
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
33+
# although not all choices may be available on all operating systems.
34+
# In a Windows environment this must be set to your system time zone.
35+
TIME_ZONE = 'America/New_York'
36+
37+
# Language code for this installation. All choices can be found here:
38+
# http://www.i18nguy.com/unicode/language-identifiers.html
39+
LANGUAGE_CODE = 'en-us'
40+
41+
SITE_ID = 1
42+
43+
# If you set this to False, Django will make some optimizations so as not
44+
# to load the internationalization machinery.
45+
USE_I18N = True
46+
47+
# If you set this to False, Django will not format dates, numbers and
48+
# calendars according to the current locale.
49+
USE_L10N = True
50+
51+
# If you set this to False, Django will not use timezone-aware datetimes.
52+
USE_TZ = True
53+
54+
# Absolute filesystem path to the directory that will hold user-uploaded files.
55+
# Example: "/var/www/example.com/media/"
56+
MEDIA_ROOT = ''
57+
58+
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
59+
# trailing slash.
60+
# Examples: "http://example.com/media/", "http://media.example.com/"
61+
MEDIA_URL = ''
62+
63+
# Absolute path to the directory static files should be collected to.
64+
# Don't put anything in this directory yourself; store your static files
65+
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
66+
# Example: "/var/www/example.com/static/"
67+
STATIC_ROOT = ''
68+
69+
# URL prefix for static files.
70+
# Example: "http://example.com/static/", "http://static.example.com/"
71+
STATIC_URL = '/static/'
72+
73+
# Additional locations of static files
74+
STATICFILES_DIRS = (
75+
# Put strings here, like "/home/html/static" or "C:/www/django/static".
76+
# Always use forward slashes, even on Windows.
77+
# Don't forget to use absolute paths, not relative paths.
78+
)
79+
80+
# List of finder classes that know how to find static files in
81+
# various locations.
82+
STATICFILES_FINDERS = (
83+
'django.contrib.staticfiles.finders.FileSystemFinder',
84+
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
85+
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
86+
)
87+
88+
# Make this unique, and don't share it with anybody.
89+
SECRET_KEY = 'b9v(#7t8mau9@5s9-swtishckoh((ndwt!#194i37h%t^pp8*t'
90+
91+
# List of callables that know how to import templates from various sources.
92+
TEMPLATE_LOADERS = (
93+
'django.template.loaders.filesystem.Loader',
94+
'django.template.loaders.app_directories.Loader',
95+
#'django.template.loaders.eggs.Loader',
96+
)
97+
98+
MIDDLEWARE_CLASSES = (
99+
'django.middleware.common.CommonMiddleware',
100+
'django.contrib.sessions.middleware.SessionMiddleware',
101+
'django.middleware.csrf.CsrfViewMiddleware',
102+
'django.contrib.auth.middleware.AuthenticationMiddleware',
103+
'django.contrib.messages.middleware.MessageMiddleware',
104+
# Uncomment the next line for simple clickjacking protection:
105+
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
106+
)
107+
108+
ROOT_URLCONF = 'mls_api_proj.urls'
109+
110+
# Python dotted path to the WSGI application used by Django's runserver.
111+
WSGI_APPLICATION = 'mls_api_proj.wsgi.application'
112+
113+
TEMPLATE_DIRS = (
114+
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
115+
# Always use forward slashes, even on Windows.
116+
# Don't forget to use absolute paths, not relative paths.
117+
)
118+
119+
INSTALLED_APPS = (
120+
'django.contrib.auth',
121+
'django.contrib.contenttypes',
122+
'django.contrib.sessions',
123+
'django.contrib.sites',
124+
'django.contrib.messages',
125+
'django.contrib.staticfiles',
126+
'django.contrib.admin',
127+
'south',
128+
'mls_api',
129+
'django_nose',
130+
'rest_framework'
131+
)
132+
133+
REST_FRAMEWORK = {
134+
# Use hyperlinked styles by default.
135+
# Only used if the `serializer_class` attribute is not set on a view.
136+
'DEFAULT_MODEL_SERIALIZER_CLASS': 'rest_framework.serializers.HyperlinkedModelSerializer',
137+
138+
# Use Django's standard `django.contrib.auth` permissions,
139+
# or allow read-only access for unauthenticated users.
140+
'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'],
141+
142+
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
143+
144+
'PAGINATE_BY': 20,
145+
}
146+
147+
# A sample logging configuration. The only tangible logging
148+
# performed by this configuration is to send an email to
149+
# the site admins on every HTTP 500 error when DEBUG=False.
150+
# See http://docs.djangoproject.com/en/dev/topics/logging for
151+
# more details on how to customize your logging configuration.
152+
LOGGING = {
153+
'version': 1,
154+
'disable_existing_loggers': False,
155+
'formatters': {
156+
'verbose': {
157+
'format': '%(levelname)s:%(asctime)s %(module)s: %(message)s'
158+
},
159+
},
160+
'filters': {
161+
'require_debug_false': {
162+
'()': 'django.utils.log.RequireDebugFalse'
163+
}
164+
},
165+
'handlers': {
166+
'mail_admins': {
167+
'level': 'ERROR',
168+
'filters': ['require_debug_false'],
169+
'class': 'django.utils.log.AdminEmailHandler'
170+
},
171+
'scraper': {
172+
'level': 'DEBUG',
173+
'class': 'logging.FileHandler',
174+
'formatter': 'verbose',
175+
'filename': 'scrape_game.log'
176+
},
177+
},
178+
'loggers': {
179+
'django.request': {
180+
'handlers': ['mail_admins'],
181+
'level': 'ERROR',
182+
'propagate': True,
183+
},
184+
'scraper': {
185+
'handlers': ['scraper'],
186+
'level': 'INFO',
187+
},
188+
}
189+
}
190+
191+
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
192+
NOSE_ARGS = ['--with-coverage', '--cover-package=mls_api', '--with-blockage']

mls_api_proj/urls.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from django.conf.urls import patterns, include, url
2+
3+
from django.contrib import admin
4+
admin.autodiscover()
5+
6+
urlpatterns = patterns('',
7+
# Examples:
8+
# url(r'^$', 'mls_api_proj.views.home', name='home'),
9+
# url(r'^mls_api_proj/', include('mls_api_proj.foo.urls')),
10+
11+
url(r'^admin/', include(admin.site.urls)),
12+
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
13+
url(r'', include('mls_api.urls')),
14+
)

mls_api_proj/wsgi.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
WSGI config for mls_api_proj 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+
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
19+
# if running multiple sites in the same mod_wsgi process. To fix this, use
20+
# mod_wsgi daemon mode with each site in its own daemon process, or use
21+
# os.environ["DJANGO_SETTINGS_MODULE"] = "mls_api_proj.settings"
22+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mls_api_proj.settings")
23+
24+
# This application object is used by any WSGI server configured to use this
25+
# file. This includes Django's development server, if the WSGI_APPLICATION
26+
# setting points here.
27+
from django.core.wsgi import get_wsgi_application
28+
application = get_wsgi_application()
29+
30+
# Apply WSGI middleware here.
31+
# from helloworld.wsgi import HelloWorldApplication
32+
# application = HelloWorldApplication(application)

0 commit comments

Comments
 (0)