diff --git a/Makefile b/Makefile index 703ba46b..65e2944a 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ -MANAGE=django-admin.py +PROJECT = django_hello_world +MANAGE = manage.py +PWD = cd $(PROJECT) test: - PYTHONPATH=`pwd` DJANGO_SETTINGS_MODULE=django_hello_world.settings $(MANAGE) test hello + $(PWD) && python $(MANAGE) test run: - PYTHONPATH=`pwd` DJANGO_SETTINGS_MODULE=django_hello_world.settings $(MANAGE) runserver + $(PWD) && python $(MANAGE) runserver syncdb: - PYTHONPATH=`pwd` DJANGO_SETTINGS_MODULE=django_hello_world.settings $(MANAGE) syncdb --noinput + $(PWD) && python $(MANAGE) syncdb --noinput \ No newline at end of file diff --git a/README b/README index b3d70af4..cc749907 100644 --- a/README +++ b/README @@ -1 +1,26 @@ -Django Hello World Project + #1 base Create basic django project that would present your name, surname, bio, contacts on the main page. Data should be stored in the DB, that's + manage.py syncdb + manage.py runserver + open the browser and all data are in, loaded from fixtures + #3 middleware&lists Create middleware that stores all http requests in the DB + #4 template context Create template-context-processor that adds django.settings to the context + #5 forms&auth Create page with form that allows to edit data, presented on the main page + #6 forms-widgets&jquery For birth date on the same page add calendar widget + #8 template-tags Create tag that accepts any object and renders the link to its admin edit page ({% edit_link request.user %}) + #9 commands Create django command that prints all project models and the count of objects in every model + #10 signals Create signal processor that, for every model, creates the db entry about the object creation/editing/deletion + #13 understanding Your customer sends the change request. Task: understand what he needs and implement. + +Requirements + + sqlite database, don't forget to add it to .gitignore + after python manage.py syncdb --noinput should work everything, including administrator login with admin/admin credentials + use virtualenv, create requirements.txt with required django version and additional libraries + doublecheck that everything works fine: + + $ git clone github:yourproject.git + $ cd yourproject + $ virtualenv --no-site-packages .env + $ source .env/bin/activate + $ .env/bin/pip install -r requirements.txt + $ python manage.py syncdb --no-input diff --git a/django_hello_world/__init__.py b/django_hello_world/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/django_hello_world/hello/__init__.py b/django_hello_world/hello/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/django_hello_world/hello/fixtures/initial_data.json b/django_hello_world/hello/fixtures/initial_data.json deleted file mode 100644 index b5cc9974..00000000 --- a/django_hello_world/hello/fixtures/initial_data.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "pk": 1, - "model": "auth.user", - "fields": { - "username": "admin", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": true, - "is_staff": true, - "last_login": "2011-08-19 09:59:01", - "groups": [], - "user_permissions": [], - "password": "sha1$b6575$27241f449f25136d2dad689f97cf3c1066cdc162", - "email": "admin@example.com", - "date_joined": "2011-08-19 09:53:08" - } - } -] \ No newline at end of file diff --git a/django_hello_world/hello/models.py b/django_hello_world/hello/models.py deleted file mode 100644 index 71a83623..00000000 --- a/django_hello_world/hello/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/django_hello_world/hello/templates/base.html b/django_hello_world/hello/templates/base.html deleted file mode 100644 index 5e46775d..00000000 --- a/django_hello_world/hello/templates/base.html +++ /dev/null @@ -1,6 +0,0 @@ - - -
You can now go to admin interface and change admin pasword
-Currently next users are registered: {% for user in users %}{{ user.username }} {% endfor %}
-{% endblock content %} diff --git a/django_hello_world/hello/tests.py b/django_hello_world/hello/tests.py deleted file mode 100644 index 1ed42f3d..00000000 --- a/django_hello_world/hello/tests.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.core.urlresolvers import reverse -from django.test import TestCase -from django.test.client import Client - - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) - - -class HttpTest(TestCase): - def test_home(self): - c = Client() - response = c.get(reverse('home')) - self.assertEqual(response.status_code, 200) - self.assertContains(response, 'Hello!') diff --git a/django_hello_world/hello/views.py b/django_hello_world/hello/views.py deleted file mode 100644 index f03d110c..00000000 --- a/django_hello_world/hello/views.py +++ /dev/null @@ -1,8 +0,0 @@ -from annoying.decorators import render_to -from django.contrib.auth.models import User - - -@render_to('hello/home.html') -def home(request): - users = User.objects.filter() - return {'users': users} diff --git a/django_hello_world/manage.py b/django_hello_world/manage.py deleted file mode 100644 index 3e4eedc9..00000000 --- a/django_hello_world/manage.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -from django.core.management import execute_manager -import imp -try: - imp.find_module('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" % __file__) - sys.exit(1) - -import settings - -if __name__ == "__main__": - execute_manager(settings) diff --git a/django_hello_world/settings.py b/django_hello_world/settings.py deleted file mode 100644 index f2789d13..00000000 --- a/django_hello_world/settings.py +++ /dev/null @@ -1,146 +0,0 @@ -# Django settings for django_hello_world project. - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - # ('Your Name', 'your_email@example.com'), -) - -MANAGERS = ADMINS - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'hello.sqlite3', # Or path to database file if using sqlite3. - 'USER': '', # Not used with sqlite3. - 'PASSWORD': '', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. - } -} - -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# On Unix systems, a value of None will cause Django to use the same -# timezone as the operating system. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = 'America/Chicago' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-us' - -SITE_ID = 1 - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale -USE_L10N = True - -# Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = '' - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash. -# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" -MEDIA_URL = '' - -# Absolute path to the directory static files should be collected to. -# Don't put anything in this directory yourself; store your static files -# in apps' "static/" subdirectories and in STATICFILES_DIRS. -# Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = '' - -# URL prefix for static files. -# Example: "http://media.lawrence.com/static/" -STATIC_URL = '/static/' - -# URL prefix for admin static files -- CSS, JavaScript and images. -# Make sure to use a trailing slash. -# Examples: "http://foo.com/static/admin/", "/static/admin/". -ADMIN_MEDIA_PREFIX = '/media/admin/' - -# Additional locations of static files -STATICFILES_DIRS = ( - # Put strings here, like "/home/html/static" or "C:/www/django/static". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - -# List of finder classes that know how to find static files in -# various locations. -STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', -) - -# Make this unique, and don't share it with anybody. -SECRET_KEY = 'j0ee6taz(y5dqbfp3)dh*+7as@pbs_w25%arj4-ds#j5%zf!nj' - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', -) - -ROOT_URLCONF = 'django_hello_world.urls' - -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. -) - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.staticfiles', - # Uncomment the next line to enable the admin: - 'django.contrib.admin', - # Uncomment the next line to enable admin documentation: - 'django.contrib.admindocs', - 'django_hello_world.hello', -) - -# A sample logging configuration. The only tangible logging -# performed by this configuration is to send an email to -# the site admins on every HTTP 500 error. -# See http://docs.djangoproject.com/en/dev/topics/logging for -# more details on how to customize your logging configuration. -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} diff --git a/django_hello_world/urls.py b/django_hello_world/urls.py deleted file mode 100644 index 3c27df94..00000000 --- a/django_hello_world/urls.py +++ /dev/null @@ -1,17 +0,0 @@ -from django.conf.urls.defaults import patterns, include, url - -# Uncomment the next two lines to enable the admin: -from django.contrib import admin -admin.autodiscover() - -urlpatterns = patterns('', - # Examples: - url(r'^$', 'django_hello_world.hello.views.home', name='home'), - # url(r'^django_hello_world/', include('django_hello_world.foo.urls')), - - # Uncomment the admin/doc line below to enable admin documentation: - url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - - # Uncomment the next line to enable the admin: - url(r'^admin/', include(admin.site.urls)), -) diff --git a/requirements.txt b/requirements.txt index 4a409173..99c1c034 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -Django >= 1.3, < 1.4 +Django >= 1.5 django-annoying >= 0.7.6