From 06fd6da45f068bbe2e44de8275db3cd6b3b53797 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sat, 26 Jul 2014 13:00:21 +0200 Subject: [PATCH] [TASK] Add private_settings.py, move some settings there. --- .gitignore | 1 + citavi_mapper/private_settings.example.py | 18 +++++++ citavi_mapper/settings.py | 48 ++++++++++++------- citavi_mapper/urls.py | 4 +- .../hello.html => frontend/__init__.py | 0 {hello => frontend}/admin.py | 0 {hello => frontend}/models.py | 0 frontend/templates/base.html | 16 +++++++ {hello => frontend}/tests.py | 0 frontend/views.py | 17 +++++++ hello/__init__.py | 2 - hello/urls.py | 10 ---- hello/views.py | 11 ----- public/templates/main.html | 11 ----- requirements.txt | 1 + 15 files changed, 88 insertions(+), 51 deletions(-) create mode 100644 citavi_mapper/private_settings.example.py rename hello/templates/hello.html => frontend/__init__.py (100%) rename {hello => frontend}/admin.py (100%) rename {hello => frontend}/models.py (100%) create mode 100644 frontend/templates/base.html rename {hello => frontend}/tests.py (100%) create mode 100644 frontend/views.py delete mode 100644 hello/__init__.py delete mode 100644 hello/urls.py delete mode 100644 hello/views.py delete mode 100644 public/templates/main.html diff --git a/.gitignore b/.gitignore index 604e3df..9812d3d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .project .pydevproject *.pyc +citavi_mapper/private_settings.py diff --git a/citavi_mapper/private_settings.example.py b/citavi_mapper/private_settings.example.py new file mode 100644 index 0000000..dec2449 --- /dev/null +++ b/citavi_mapper/private_settings.example.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'SECRET' + +# Database +# https://docs.djangoproject.com/en/1.6/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'citavi_mapper', + 'USER': 'citavi_mapper', + 'PASSWORD': 'SECRET', + 'HOST': 'localhost', + 'PORT': '5432' + } +} diff --git a/citavi_mapper/settings.py b/citavi_mapper/settings.py index 838df29..8e39ff7 100644 --- a/citavi_mapper/settings.py +++ b/citavi_mapper/settings.py @@ -18,9 +18,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = '$0$7v0&fg0yh*77_bre9_+1clj1b_g8flt=)c&5d^je9yvissh' - # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -38,8 +35,9 @@ INSTALLED_APPS = ( 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'pipeline', 'crispy_forms', - 'hello', + 'frontend', ) MIDDLEWARE_CLASSES = ( @@ -55,23 +53,36 @@ ROOT_URLCONF = 'citavi_mapper.urls' WSGI_APPLICATION = 'citavi_mapper.wsgi.application' +STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' -CRISPY_TEMPLATE_PACK = 'bootstrap3' +PIPELINE_CSS = { + 'colors': { + 'source_filenames': ( + 'css/core.css', + 'css/colors/*.css', + 'css/layers.css' + ), + 'output_filename': 'css/colors.css', + 'extra_context': { + 'media': 'screen,projection', + }, + }, +} -# Database -# https://docs.djangoproject.com/en/1.6/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'citavi_mapper', - 'USER': 'citavi_mapper', - 'PASSWORD': 'foobar2000', - 'HOST': 'pgdb.it.hs-hannover.de', - 'PORT': '5432' +PIPELINE_JS = { + 'stats': { + 'source_filenames': ( + 'js/jquery.js', + 'js/d3.js', + 'js/collections/*.js', + 'js/application.js', + ), + 'output_filename': 'js/stats.js', } } +CRISPY_TEMPLATE_PACK = 'bootstrap3' + # Internationalization # https://docs.djangoproject.com/en/1.6/topics/i18n/ @@ -90,3 +101,8 @@ USE_TZ = True # https://docs.djangoproject.com/en/1.6/howto/static-files/ STATIC_URL = '/static/' + + + +# import the private settings last to allow override +from private_settings import * diff --git a/citavi_mapper/urls.py b/citavi_mapper/urls.py index 200f950..0d39edc 100644 --- a/citavi_mapper/urls.py +++ b/citavi_mapper/urls.py @@ -5,10 +5,12 @@ from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() +from frontend.views import MainSite + urlpatterns = patterns('', # Examples: # url(r'^$', 'citavi_mapper.views.home', name='home'), # url(r'^blog/', include('blog.urls')), - url(r'^hello/', include('hello.urls')), + url(r'^$', MainSite.as_view(), name='frontend-index'), url(r'^admin/', include(admin.site.urls)), ) diff --git a/hello/templates/hello.html b/frontend/__init__.py similarity index 100% rename from hello/templates/hello.html rename to frontend/__init__.py diff --git a/hello/admin.py b/frontend/admin.py similarity index 100% rename from hello/admin.py rename to frontend/admin.py diff --git a/hello/models.py b/frontend/models.py similarity index 100% rename from hello/models.py rename to frontend/models.py diff --git a/frontend/templates/base.html b/frontend/templates/base.html new file mode 100644 index 0000000..bb031bb --- /dev/null +++ b/frontend/templates/base.html @@ -0,0 +1,16 @@ + + + + + + + + {% block title %}Citavi Mapper :: {{ title }}{% endblock %} + + +

{{ headline }}

+
+ {% block content %}{{ content }}{% endblock %}t +
+ + \ No newline at end of file diff --git a/hello/tests.py b/frontend/tests.py similarity index 100% rename from hello/tests.py rename to frontend/tests.py diff --git a/frontend/views.py b/frontend/views.py new file mode 100644 index 0000000..55b9c83 --- /dev/null +++ b/frontend/views.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from django.views.generic import TemplateView + +class MainSite(TemplateView): + template_name = "base.html" + + def get(self, request, **kwargs): + self._request = request + return super(MainSite, self).get(request, **kwargs) + + def get_context_data(self, **kwargs): + context = super(MainSite, self).get_context_data(**kwargs) + context['title'] = 'Titeltest' + context['content'] = 'Foobar!' + context['headline'] = 'Yo!' + return context diff --git a/hello/__init__.py b/hello/__init__.py deleted file mode 100644 index 633f866..0000000 --- a/hello/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# -*- coding: utf-8 -*- - diff --git a/hello/urls.py b/hello/urls.py deleted file mode 100644 index d07a34b..0000000 --- a/hello/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- - -from django.conf.urls import patterns, url - -from hello import views - -urlpatterns = patterns('', - url(r'^$', views.Hello.as_view(), name='hello'), - url(r'^formtest/$', views.FormTest.as_view(), name='formtest') -) \ No newline at end of file diff --git a/hello/views.py b/hello/views.py deleted file mode 100644 index 08959a4..0000000 --- a/hello/views.py +++ /dev/null @@ -1,11 +0,0 @@ -# -*- coding: utf-8 -*- - -from django.http import HttpResponse -from django.views.generic import TemplateView -from django.views.generic import FormView - -class Hello(TemplateView): - template_name = "hello.html" - -class FormTest(FormView): - pass \ No newline at end of file diff --git a/public/templates/main.html b/public/templates/main.html deleted file mode 100644 index 0dffa8a..0000000 --- a/public/templates/main.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - {% block title %}Citavi Mapper{% endblock %} - - -

{% block headline %}{% endblock %}

- {% block content %}{% endblock %} - - \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index f49e1bd..e6769ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ psycopg2 django django-crispy-forms +django-pipeline