-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef0d1c3
commit d970010
Showing
12 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.pyc | ||
*.swp | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
application: bowenbroslate | ||
version: 1 | ||
runtime: python | ||
api_version: 1 | ||
|
||
handlers: | ||
- url: /static | ||
static_dir: static | ||
|
||
- url: /.* | ||
script: main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import logging, os, sys | ||
|
||
# Google App Engine imports. | ||
from google.appengine.ext.webapp import util | ||
|
||
# Force sys.path to have our own directory first, in case we want to import | ||
# from it. | ||
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) | ||
|
||
# Must set this env var *before* importing any part of Django | ||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | ||
|
||
import logging | ||
import django.core.handlers.wsgi | ||
import django.core.signals | ||
import django.db | ||
import django.dispatch.dispatcher | ||
|
||
def log_exception(*args, **kwds): | ||
logging.exception('Exception in request:') | ||
|
||
# Log errors. | ||
django.dispatch.dispatcher.connect( | ||
log_exception, django.core.signals.got_request_exception) | ||
|
||
# Unregister the rollback event handler. | ||
django.dispatch.dispatcher.disconnect( | ||
django.db._rollback_on_exception, | ||
django.core.signals.got_request_exception) | ||
|
||
def main(): | ||
# Create a Django application for WSGI. | ||
application = django.core.handlers.wsgi.WSGIHandler() | ||
|
||
# Run the WSGI CGI handler with that application. | ||
util.run_wsgi_app(application) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python | ||
from django.core.management import execute_manager | ||
try: | ||
import settings # Assumed to be in the same directory. | ||
except ImportError: | ||
import sys | ||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) | ||
sys.exit(1) | ||
|
||
if __name__ == "__main__": | ||
execute_manager(settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
|
||
# 'project' refers to the name of the module created with django-admin.py | ||
ROOT_URLCONF = 'urls' | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
# 'django.contrib.sessions.middleware.SessionMiddleware', | ||
# 'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.middleware.doc.XViewMiddleware', | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
# 'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
# 'django.contrib.sessions', | ||
'django.contrib.sites', | ||
) | ||
|
||
ROOT_PATH = os.path.dirname(__file__) | ||
TEMPLATE_DIRS = ( | ||
# Put strings here, like "/home/html/django_templates" or | ||
# "C:/www/django/templates". Always use forward slashes, even on Windows. | ||
# Don't forget to use absolute paths, not relative paths. | ||
ROOT_PATH + '/templates', | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.admin', | ||
'myBlog.posts', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
from django.conf.urls.defaults import * | ||
from django.conf import settings | ||
import website.views | ||
|
||
# Uncomment the next two lines to enable the admin: | ||
from django.contrib import admin | ||
#admin.autodiscover() | ||
|
||
urlpatterns = patterns('', | ||
# Example: | ||
# (r'^myBlog/', include('myBlog.foo.urls')), | ||
|
||
# Uncomment the admin/doc line below and add 'django.contrib.admindocs' | ||
# to INSTALLED_APPS to enable admin documentation: | ||
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
|
||
# Uncomment the next line to enable the admin: | ||
#(r'^admin/(.*)', admin.site.root), | ||
(r'^$', website.views.index), | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from myBlog.posts.models import Post | ||
from django.contrib import admin | ||
|
||
admin.site.register(Post) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
|
||
class Post(models.Model): | ||
author = models.ForeignKey(User) | ||
date = models.DateTimeField() | ||
title = models.CharField(max_length=100) | ||
post = models.TextField() | ||
def __str__(self): | ||
return self.title | ||
class Admin: | ||
list_display = ('author', 'date', 'title') | ||
search_fields = ('title', 'post') | ||
list_filter = ('author', 'date') | ||
|
||
|
||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
|
||
class Post(models.Model): | ||
author = models.ForeignKey(User) | ||
date = models.DateTimeField() | ||
title = models.CharField(max_length=100) | ||
post = models.TextField() | ||
def __str__(self): | ||
return self.title | ||
class Admin: | ||
pass | ||
|
||
|
||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.http import HttpResponse | ||
|
||
def index(request): | ||
return HttpResponse("Hello world!") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Create your views here. |