Last active
February 27, 2017 16:19
-
-
Save yoniLavi/6fda414c42dadb08a6070c5c7108d6b6 to your computer and use it in GitHub Desktop.
Example of simplest possible Django Project
This file contains hidden or 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
| # Based on the book 'Lightweight Django' | |
| # by Mark Lavin & Julia Elman | |
| # See the following Repo for this example broken into multiple files. | |
| # https://github.com/richardadalton/djangolight | |
| from django.core.management import execute_from_command_line | |
| from django.conf import settings | |
| from django.conf.urls import url | |
| from django.http import HttpResponse | |
| # SETTINGS | |
| settings.configure( | |
| DEBUG=True, | |
| SECRET_KEY='thisisthesecretkey', | |
| ROOT_URLCONF=__name__, | |
| MIDDLEWARE_CLASSES=('django.middleware.common.CommonMiddleware',), | |
| ) | |
| # VIEWS | |
| def index(request): | |
| return HttpResponse('Hello World') | |
| # URLS | |
| urlpatterns = ( | |
| url(r'^$', index), | |
| ) | |
| # MANAGE.PY Command Line Handler | |
| if __name__ == "__main__": | |
| execute_from_command_line(['', 'runserver']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment