From: Radek Czajka Date: Wed, 31 Jul 2013 20:13:22 +0000 (+0200) Subject: Separate src dir. X-Git-Url: https://git.mdrn.pl/fnp-django-template.git/commitdiff_plain/74b5ddcfc3af0c3155915f54c2490fcdda0d19f7?ds=sidebyside Separate src dir. --- diff --git a/fabfile.py b/fabfile.py index 0e488b7..6196757 100644 --- a/fabfile.py +++ b/fabfile.py @@ -7,3 +7,5 @@ env.app_path = '/srv/{{ project_name }}' env.services = [ DebianGunicorn('{{ project_name }}'), ] +env.django_root_path = 'src' + diff --git a/manage.py b/manage.py deleted file mode 100755 index 391dd88..0000000 --- a/manage.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") - - from django.core.management import execute_from_command_line - - execute_from_command_line(sys.argv) diff --git a/project_name/__init__.py b/project_name/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/project_name/locale/pl/LC_MESSAGES/django.mo b/project_name/locale/pl/LC_MESSAGES/django.mo deleted file mode 100644 index bd15844..0000000 Binary files a/project_name/locale/pl/LC_MESSAGES/django.mo and /dev/null differ diff --git a/project_name/locale/pl/LC_MESSAGES/django.po b/project_name/locale/pl/LC_MESSAGES/django.po deleted file mode 100644 index ffd5d7b..0000000 --- a/project_name/locale/pl/LC_MESSAGES/django.po +++ /dev/null @@ -1,28 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-11-19 15:57+0100\n" -"PO-Revision-Date: 2012-11-19 15:58+0100\n" -"Last-Translator: Radek Czajka \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" - -#: templates/404.html:4 -#: templates/404.html.py:8 -msgid "Page not found" -msgstr "Strona nie znaleziona" - -#: templates/404.html:11 -msgid "The page you were looking for doesn't exist." -msgstr "Strona której szukasz nie została znaleziona." - diff --git a/project_name/localsettings.py.dev b/project_name/localsettings.py.dev deleted file mode 100644 index 303bfd7..0000000 --- a/project_name/localsettings.py.dev +++ /dev/null @@ -1,12 +0,0 @@ -DEBUG = True -ADMINS = MANAGERS = [ - ('Admin', 'admin@example.com'), -] -EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' - -if False: - INSTALLED_APPS += ('debug_toolbar',) - MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) - INTERNAL_IPS = ('127.0.0.1',) - -SECRET_KEY = 'secret_key' diff --git a/project_name/settings/__init__.py b/project_name/settings/__init__.py deleted file mode 100644 index 8ce1902..0000000 --- a/project_name/settings/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -from .paths import * -from .basic import * -from .apps import * -from .locale import * -from .auth import * -from .context import * -from .middleware import * -from .static import * -from .logging import * -from .contrib import * -from .custom import * - - -# Load localsettings, if they exist -try: - from ..localsettings import * -except ImportError: - pass diff --git a/project_name/settings/apps.py b/project_name/settings/apps.py deleted file mode 100644 index 903d857..0000000 --- a/project_name/settings/apps.py +++ /dev/null @@ -1,19 +0,0 @@ -INSTALLED_APPS = ( - '{{ project_name }}', - 'fnpdjango', - 'south', - 'pipeline', - # Disable, if not using Piwik. - 'piwik.django', - # Disable, if not using CAS. - 'django_cas', - - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.admin', - 'django.contrib.admindocs', -) diff --git a/project_name/settings/auth.py b/project_name/settings/auth.py deleted file mode 100644 index 91b062e..0000000 --- a/project_name/settings/auth.py +++ /dev/null @@ -1,8 +0,0 @@ -from . import INSTALLED_APPS - - -if 'django_cas' in INSTALLED_APPS: - AUTHENTICATION_BACKENDS = ( - 'django.contrib.auth.backends.ModelBackend', - 'django_cas.backends.CASBackend', - ) diff --git a/project_name/settings/basic.py b/project_name/settings/basic.py deleted file mode 100644 index 65bfd83..0000000 --- a/project_name/settings/basic.py +++ /dev/null @@ -1,37 +0,0 @@ -from os import path -from . import PROJECT_DIR - - -DEBUG = False -TEMPLATE_DEBUG = DEBUG - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': path.join(PROJECT_DIR, 'dev.db'), # 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. - } -} - -SITE_ID = 1 - -# 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', -) - -ROOT_URLCONF = '{{ project_name }}.urls' - -# Python dotted path to the WSGI application used by Django's runserver. -WSGI_APPLICATION = '{{ project_name }}.wsgi.application' - -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. -) diff --git a/project_name/settings/context.py b/project_name/settings/context.py deleted file mode 100644 index ec4ef61..0000000 --- a/project_name/settings/context.py +++ /dev/null @@ -1,15 +0,0 @@ -from . import INSTALLED_APPS - - -TEMPLATE_CONTEXT_PROCESSORS = tuple(x for x in ( - "django.contrib.auth.context_processors.auth" - if "django.contrib.auth" in INSTALLED_APPS else None, - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "django.core.context_processors.media", - "django.core.context_processors.static", - "django.core.context_processors.tz", - "django.contrib.messages.context_processors.messages" - if 'django.contrib.messages' in INSTALLED_APPS else None, - "django.core.context_processors.request" -) if x is not None) diff --git a/project_name/settings/contrib.py b/project_name/settings/contrib.py deleted file mode 100644 index 2210cf1..0000000 --- a/project_name/settings/contrib.py +++ /dev/null @@ -1,2 +0,0 @@ -CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/' -CAS_VERSION = '1' diff --git a/project_name/settings/custom.py b/project_name/settings/custom.py deleted file mode 100644 index e69de29..0000000 diff --git a/project_name/settings/locale.py b/project_name/settings/locale.py deleted file mode 100644 index d77583d..0000000 --- a/project_name/settings/locale.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -LANGUAGES = ( - ('pl', u'polski'), -# ('en', u'English'), -) - -# 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 = None - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'pl' - -# 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 - -# If you set this to False, Django will not use timezone-aware datetimes. -USE_TZ = True diff --git a/project_name/settings/logging.py b/project_name/settings/logging.py deleted file mode 100644 index 3d91c9c..0000000 --- a/project_name/settings/logging.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 when DEBUG=False. -# 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, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - } - }, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} diff --git a/project_name/settings/middleware.py b/project_name/settings/middleware.py deleted file mode 100644 index 80ffc44..0000000 --- a/project_name/settings/middleware.py +++ /dev/null @@ -1,25 +0,0 @@ -from . import INSTALLED_APPS - - -MIDDLEWARE_CLASSES = tuple(x for x in ( - 'django.contrib.sessions.middleware.SessionMiddleware' - if "django.contrib.sessions" in INSTALLED_APPS else None, - #'django.middleware.locale.LocaleMiddleware', - 'fnpdjango.middleware.URLLocaleMiddleware', - - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware' - if "django.contrib.auth" in INSTALLED_APPS else None, - 'django_cas.middleware.CASMiddleware' - if "django_cas" in INSTALLED_APPS else None, - 'django.contrib.messages.middleware.MessageMiddleware' - if "django.contrib.messages" in INSTALLED_APPS else None, - 'piwik.django.middleware.PiwikMiddleware' - if "piwik.django" in INSTALLED_APPS else None, - # Uncomment the next line for simple clickjacking protection: - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'pagination.middleware.PaginationMiddleware' - if "pagination" in INSTALLED_APPS else None, - 'fnpdjango.middleware.SetRemoteAddrFromXRealIP' -) if x is not None) diff --git a/project_name/settings/paths.py b/project_name/settings/paths.py deleted file mode 100644 index b3ef304..0000000 --- a/project_name/settings/paths.py +++ /dev/null @@ -1,3 +0,0 @@ -from os import path - -PROJECT_DIR = path.dirname(path.abspath(path.dirname(__file__))) diff --git a/project_name/settings/static.py b/project_name/settings/static.py deleted file mode 100644 index 23f305e..0000000 --- a/project_name/settings/static.py +++ /dev/null @@ -1,39 +0,0 @@ -from os import path -from paths import PROJECT_DIR - - -MEDIA_ROOT = path.join(PROJECT_DIR, 'media/') -MEDIA_URL = '/media/' -STATIC_ROOT = path.join(PROJECT_DIR, 'static/') -STATIC_URL = '/static/' - -STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', -) - -STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' -PIPELINE_CSS_COMPRESSOR = None -PIPELINE_JS_COMPRESSOR = None -PIPELINE_CSS = { - 'base': { - 'source_filenames': ( - 'css/base.scss', - ), - 'output_filename': 'compressed/base.css', - }, -} -PIPELINE_JS = { - 'base': { - 'source_filenames': ( - ), - 'output_filename': 'compressed/base.js', - }, -} - -PIPELINE_COMPILERS = ( - 'pipeline.compilers.sass.SASSCompiler', -) - -PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage' diff --git a/project_name/static/css/base.scss b/project_name/static/css/base.scss deleted file mode 100755 index e69de29..0000000 diff --git a/project_name/templates/404.html b/project_name/templates/404.html deleted file mode 100644 index 74ee437..0000000 --- a/project_name/templates/404.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans "Page not found" %}{% endblock %} - -{% block body %} - -

{% trans "Page not found" %}

- -

- {% trans "The page you were looking for doesn't exist." %} -

- -{% endblock %} diff --git a/project_name/templates/500.html b/project_name/templates/500.html deleted file mode 100644 index be751c1..0000000 --- a/project_name/templates/500.html +++ /dev/null @@ -1,5 +0,0 @@ -

Wystąpił błąd serwera.

- -

Coś poszło nie tak. Administratorzy zostali już powiadomieni.

- -

Przepraszamy!

diff --git a/project_name/templates/base.html b/project_name/templates/base.html deleted file mode 100644 index f96037b..0000000 --- a/project_name/templates/base.html +++ /dev/null @@ -1,34 +0,0 @@ - -{% load url from future %} -{% load i18n static %} -{% load fnp_common fnp_share fnp_lang macros %} -{% load compressed %} - -{% macro title %} - {% block title %}{% endblock %} -{% endmacro %} -{% macro site_name %}MySite{% endmacro %} - - - - {% block full_title %}{% usemacro title %} :: {% usemacro site_name %}{% endblock %} - - {% compressed_css 'base' %} - - - - - - - - - - - - {% block "body" %}{% endblock %} - - - {% compressed_js 'base' %} - {{ piwik_tag|safe }} - - diff --git a/project_name/urls.py b/project_name/urls.py deleted file mode 100644 index c579b39..0000000 --- a/project_name/urls.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.conf.urls import patterns, include, url -from django.conf import settings - -urlpatterns = patterns('', - # Examples: - # url(r'^$', '{{ project_name }}.views.home', name='home'), - # url(r'^{{ project_name }}/', include('foo.urls')), -) - - -# Admin stuff, if necessary. -if 'django.contrib.admin' in settings.INSTALLED_APPS: - from django.contrib import admin - admin.autodiscover() - - urlpatterns += patterns('', - url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - url(r'^admin/', include(admin.site.urls)), - ) - -# Auth stuff, if necessary -if 'django_cas' in settings.INSTALLED_APPS: - urlpatterns += patterns('', - (r'^accounts/login/$', 'django_cas.views.login'), - (r'^accounts/logout/$', 'django_cas.views.logout'), - ) - -# Media in DEBUG mode -if settings.DEBUG: - urlpatterns += patterns('', - url(r'^media/(?P.*)$', 'django.views.static.serve', { - 'document_root': settings.MEDIA_ROOT, - }), - ) diff --git a/project_name/wsgi.py b/project_name/wsgi.py deleted file mode 100644 index f768265..0000000 --- a/project_name/wsgi.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -WSGI config for {{ project_name }} project. - -This module contains the WSGI application used by Django's development server -and any production WSGI deployments. It should expose a module-level variable -named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover -this application via the ``WSGI_APPLICATION`` setting. - -Usually you will have the standard Django WSGI application here, but it also -might make sense to replace the whole Django WSGI application with a custom one -that later delegates to the Django one. For example, you could introduce WSGI -middleware here, or combine a Django application with an application of another -framework. - -""" -import os - -# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks -# if running multiple sites in the same mod_wsgi process. To fix this, use -# mod_wsgi daemon mode with each site in its own daemon process, or use -# os.environ["DJANGO_SETTINGS_MODULE"] = "{{ project_name }}.settings" -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") - -# This application object is used by any WSGI server configured to use this -# file. This includes Django's development server, if the WSGI_APPLICATION -# setting points here. -from django.core.wsgi import get_wsgi_application -application = get_wsgi_application() - -# Apply WSGI middleware here. -# from helloworld.wsgi import HelloWorldApplication -# application = HelloWorldApplication(application) diff --git a/src/manage.py b/src/manage.py new file mode 100755 index 0000000..391dd88 --- /dev/null +++ b/src/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/src/project_name/__init__.py b/src/project_name/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/project_name/locale/pl/LC_MESSAGES/django.mo b/src/project_name/locale/pl/LC_MESSAGES/django.mo new file mode 100644 index 0000000..bd15844 Binary files /dev/null and b/src/project_name/locale/pl/LC_MESSAGES/django.mo differ diff --git a/src/project_name/locale/pl/LC_MESSAGES/django.po b/src/project_name/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 0000000..ffd5d7b --- /dev/null +++ b/src/project_name/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,28 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-19 15:57+0100\n" +"PO-Revision-Date: 2012-11-19 15:58+0100\n" +"Last-Translator: Radek Czajka \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" + +#: templates/404.html:4 +#: templates/404.html.py:8 +msgid "Page not found" +msgstr "Strona nie znaleziona" + +#: templates/404.html:11 +msgid "The page you were looking for doesn't exist." +msgstr "Strona której szukasz nie została znaleziona." + diff --git a/src/project_name/localsettings.py.dev b/src/project_name/localsettings.py.dev new file mode 100644 index 0000000..303bfd7 --- /dev/null +++ b/src/project_name/localsettings.py.dev @@ -0,0 +1,12 @@ +DEBUG = True +ADMINS = MANAGERS = [ + ('Admin', 'admin@example.com'), +] +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +if False: + INSTALLED_APPS += ('debug_toolbar',) + MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) + INTERNAL_IPS = ('127.0.0.1',) + +SECRET_KEY = 'secret_key' diff --git a/src/project_name/settings/__init__.py b/src/project_name/settings/__init__.py new file mode 100644 index 0000000..8ce1902 --- /dev/null +++ b/src/project_name/settings/__init__.py @@ -0,0 +1,18 @@ +from .paths import * +from .basic import * +from .apps import * +from .locale import * +from .auth import * +from .context import * +from .middleware import * +from .static import * +from .logging import * +from .contrib import * +from .custom import * + + +# Load localsettings, if they exist +try: + from ..localsettings import * +except ImportError: + pass diff --git a/src/project_name/settings/apps.py b/src/project_name/settings/apps.py new file mode 100644 index 0000000..903d857 --- /dev/null +++ b/src/project_name/settings/apps.py @@ -0,0 +1,19 @@ +INSTALLED_APPS = ( + '{{ project_name }}', + 'fnpdjango', + 'south', + 'pipeline', + # Disable, if not using Piwik. + 'piwik.django', + # Disable, if not using CAS. + 'django_cas', + + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.admin', + 'django.contrib.admindocs', +) diff --git a/src/project_name/settings/auth.py b/src/project_name/settings/auth.py new file mode 100644 index 0000000..91b062e --- /dev/null +++ b/src/project_name/settings/auth.py @@ -0,0 +1,8 @@ +from . import INSTALLED_APPS + + +if 'django_cas' in INSTALLED_APPS: + AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'django_cas.backends.CASBackend', + ) diff --git a/src/project_name/settings/basic.py b/src/project_name/settings/basic.py new file mode 100644 index 0000000..65bfd83 --- /dev/null +++ b/src/project_name/settings/basic.py @@ -0,0 +1,37 @@ +from os import path +from . import PROJECT_DIR + + +DEBUG = False +TEMPLATE_DEBUG = DEBUG + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': path.join(PROJECT_DIR, 'dev.db'), # 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. + } +} + +SITE_ID = 1 + +# 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', +) + +ROOT_URLCONF = '{{ project_name }}.urls' + +# Python dotted path to the WSGI application used by Django's runserver. +WSGI_APPLICATION = '{{ project_name }}.wsgi.application' + +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. +) diff --git a/src/project_name/settings/context.py b/src/project_name/settings/context.py new file mode 100644 index 0000000..ec4ef61 --- /dev/null +++ b/src/project_name/settings/context.py @@ -0,0 +1,15 @@ +from . import INSTALLED_APPS + + +TEMPLATE_CONTEXT_PROCESSORS = tuple(x for x in ( + "django.contrib.auth.context_processors.auth" + if "django.contrib.auth" in INSTALLED_APPS else None, + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.static", + "django.core.context_processors.tz", + "django.contrib.messages.context_processors.messages" + if 'django.contrib.messages' in INSTALLED_APPS else None, + "django.core.context_processors.request" +) if x is not None) diff --git a/src/project_name/settings/contrib.py b/src/project_name/settings/contrib.py new file mode 100644 index 0000000..2210cf1 --- /dev/null +++ b/src/project_name/settings/contrib.py @@ -0,0 +1,2 @@ +CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/' +CAS_VERSION = '1' diff --git a/src/project_name/settings/custom.py b/src/project_name/settings/custom.py new file mode 100644 index 0000000..e69de29 diff --git a/src/project_name/settings/locale.py b/src/project_name/settings/locale.py new file mode 100644 index 0000000..d77583d --- /dev/null +++ b/src/project_name/settings/locale.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +LANGUAGES = ( + ('pl', u'polski'), +# ('en', u'English'), +) + +# 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 = None + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'pl' + +# 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 + +# If you set this to False, Django will not use timezone-aware datetimes. +USE_TZ = True diff --git a/src/project_name/settings/logging.py b/src/project_name/settings/logging.py new file mode 100644 index 0000000..3d91c9c --- /dev/null +++ b/src/project_name/settings/logging.py @@ -0,0 +1,28 @@ +# 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 when DEBUG=False. +# 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, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +} diff --git a/src/project_name/settings/middleware.py b/src/project_name/settings/middleware.py new file mode 100644 index 0000000..80ffc44 --- /dev/null +++ b/src/project_name/settings/middleware.py @@ -0,0 +1,25 @@ +from . import INSTALLED_APPS + + +MIDDLEWARE_CLASSES = tuple(x for x in ( + 'django.contrib.sessions.middleware.SessionMiddleware' + if "django.contrib.sessions" in INSTALLED_APPS else None, + #'django.middleware.locale.LocaleMiddleware', + 'fnpdjango.middleware.URLLocaleMiddleware', + + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware' + if "django.contrib.auth" in INSTALLED_APPS else None, + 'django_cas.middleware.CASMiddleware' + if "django_cas" in INSTALLED_APPS else None, + 'django.contrib.messages.middleware.MessageMiddleware' + if "django.contrib.messages" in INSTALLED_APPS else None, + 'piwik.django.middleware.PiwikMiddleware' + if "piwik.django" in INSTALLED_APPS else None, + # Uncomment the next line for simple clickjacking protection: + # 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'pagination.middleware.PaginationMiddleware' + if "pagination" in INSTALLED_APPS else None, + 'fnpdjango.middleware.SetRemoteAddrFromXRealIP' +) if x is not None) diff --git a/src/project_name/settings/paths.py b/src/project_name/settings/paths.py new file mode 100644 index 0000000..b3ef304 --- /dev/null +++ b/src/project_name/settings/paths.py @@ -0,0 +1,3 @@ +from os import path + +PROJECT_DIR = path.dirname(path.abspath(path.dirname(__file__))) diff --git a/src/project_name/settings/static.py b/src/project_name/settings/static.py new file mode 100644 index 0000000..23f305e --- /dev/null +++ b/src/project_name/settings/static.py @@ -0,0 +1,39 @@ +from os import path +from paths import PROJECT_DIR + + +MEDIA_ROOT = path.join(PROJECT_DIR, 'media/') +MEDIA_URL = '/media/' +STATIC_ROOT = path.join(PROJECT_DIR, 'static/') +STATIC_URL = '/static/' + +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +# 'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + +STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' +PIPELINE_CSS_COMPRESSOR = None +PIPELINE_JS_COMPRESSOR = None +PIPELINE_CSS = { + 'base': { + 'source_filenames': ( + 'css/base.scss', + ), + 'output_filename': 'compressed/base.css', + }, +} +PIPELINE_JS = { + 'base': { + 'source_filenames': ( + ), + 'output_filename': 'compressed/base.js', + }, +} + +PIPELINE_COMPILERS = ( + 'pipeline.compilers.sass.SASSCompiler', +) + +PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage' diff --git a/src/project_name/static/css/base.scss b/src/project_name/static/css/base.scss new file mode 100755 index 0000000..e69de29 diff --git a/src/project_name/templates/404.html b/src/project_name/templates/404.html new file mode 100644 index 0000000..74ee437 --- /dev/null +++ b/src/project_name/templates/404.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans "Page not found" %}{% endblock %} + +{% block body %} + +

{% trans "Page not found" %}

+ +

+ {% trans "The page you were looking for doesn't exist." %} +

+ +{% endblock %} diff --git a/src/project_name/templates/500.html b/src/project_name/templates/500.html new file mode 100644 index 0000000..be751c1 --- /dev/null +++ b/src/project_name/templates/500.html @@ -0,0 +1,5 @@ +

Wystąpił błąd serwera.

+ +

Coś poszło nie tak. Administratorzy zostali już powiadomieni.

+ +

Przepraszamy!

diff --git a/src/project_name/templates/base.html b/src/project_name/templates/base.html new file mode 100644 index 0000000..f96037b --- /dev/null +++ b/src/project_name/templates/base.html @@ -0,0 +1,34 @@ + +{% load url from future %} +{% load i18n static %} +{% load fnp_common fnp_share fnp_lang macros %} +{% load compressed %} + +{% macro title %} + {% block title %}{% endblock %} +{% endmacro %} +{% macro site_name %}MySite{% endmacro %} + + + + {% block full_title %}{% usemacro title %} :: {% usemacro site_name %}{% endblock %} + + {% compressed_css 'base' %} + + + + + + + + + + + + {% block "body" %}{% endblock %} + + + {% compressed_js 'base' %} + {{ piwik_tag|safe }} + + diff --git a/src/project_name/urls.py b/src/project_name/urls.py new file mode 100644 index 0000000..c579b39 --- /dev/null +++ b/src/project_name/urls.py @@ -0,0 +1,34 @@ +from django.conf.urls import patterns, include, url +from django.conf import settings + +urlpatterns = patterns('', + # Examples: + # url(r'^$', '{{ project_name }}.views.home', name='home'), + # url(r'^{{ project_name }}/', include('foo.urls')), +) + + +# Admin stuff, if necessary. +if 'django.contrib.admin' in settings.INSTALLED_APPS: + from django.contrib import admin + admin.autodiscover() + + urlpatterns += patterns('', + url(r'^admin/doc/', include('django.contrib.admindocs.urls')), + url(r'^admin/', include(admin.site.urls)), + ) + +# Auth stuff, if necessary +if 'django_cas' in settings.INSTALLED_APPS: + urlpatterns += patterns('', + (r'^accounts/login/$', 'django_cas.views.login'), + (r'^accounts/logout/$', 'django_cas.views.logout'), + ) + +# Media in DEBUG mode +if settings.DEBUG: + urlpatterns += patterns('', + url(r'^media/(?P.*)$', 'django.views.static.serve', { + 'document_root': settings.MEDIA_ROOT, + }), + ) diff --git a/src/project_name/wsgi.py b/src/project_name/wsgi.py new file mode 100644 index 0000000..f768265 --- /dev/null +++ b/src/project_name/wsgi.py @@ -0,0 +1,32 @@ +""" +WSGI config for {{ project_name }} project. + +This module contains the WSGI application used by Django's development server +and any production WSGI deployments. It should expose a module-level variable +named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover +this application via the ``WSGI_APPLICATION`` setting. + +Usually you will have the standard Django WSGI application here, but it also +might make sense to replace the whole Django WSGI application with a custom one +that later delegates to the Django one. For example, you could introduce WSGI +middleware here, or combine a Django application with an application of another +framework. + +""" +import os + +# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks +# if running multiple sites in the same mod_wsgi process. To fix this, use +# mod_wsgi daemon mode with each site in its own daemon process, or use +# os.environ["DJANGO_SETTINGS_MODULE"] = "{{ project_name }}.settings" +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") + +# This application object is used by any WSGI server configured to use this +# file. This includes Django's development server, if the WSGI_APPLICATION +# setting points here. +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() + +# Apply WSGI middleware here. +# from helloworld.wsgi import HelloWorldApplication +# application = HelloWorldApplication(application)