From 618aa896be62efee106261ff4f67d52613a1159a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Barrioneuvo=20da=20Luz?= Date: Mon, 11 Nov 2013 16:11:15 -0300 Subject: [PATCH] change requiriments, urls, remove S3 dependencies, add new dependencies and fix templates --- .gitignore | 58 +++++++++++- README.rst | 5 ++ .../requirements/base.txt | 20 +++++ .../requirements/local.txt | 2 + .../config/settings.py | 89 ++++++++++++------- .../{{cookiecutter.repo_name}}/config/urls.py | 17 ++++ .../static/css/project.css | 32 +++++++ .../templates/base.html | 14 ++- 8 files changed, 202 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index 3f36ae8c1..52fdd7dc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,61 @@ +*.py[cod] +*.pyc + +# C extensions +*.so + +# Logs +*.log + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 +__pycache__ + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml + +# Translations +*.mo +*.pot + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Pycharm +.idea + +# Vim + +*~ +*.swp +*.swo + +# Django +local_settings.py +repo_name + *.log *.pot *.pyc local_settings.py -repo_name \ No newline at end of file +repo_name + diff --git a/README.rst b/README.rst index d2e4f3a96..292f2842d 100644 --- a/README.rst +++ b/README.rst @@ -83,6 +83,11 @@ Create a GitHub repo and push it there:: Now take a look at your repo. Don't forget to carefully look at the generated README. Awesome, right? + +Now install all the supporting libraries into your virtualenv:: + + $ pip install -r requirements/local.txt + It's time to write the code!!! diff --git a/{{cookiecutter.repo_name}}/requirements/base.txt b/{{cookiecutter.repo_name}}/requirements/base.txt index cb7d1a595..5dcf1abe9 100644 --- a/{{cookiecutter.repo_name}}/requirements/base.txt +++ b/{{cookiecutter.repo_name}}/requirements/base.txt @@ -37,3 +37,23 @@ django-avatar==2.0 # Your custom requirements go here + +#Bootstrap 3 integration with Django. Easily generate Bootstrap3 compatible HTML using template tags. +#https://github.com/dyve/django-bootstrap3 +django-bootstrap3 +django-bootstrap-toolkit + +# autocomplete +django-autocomplete-light + +# django admin theme +django-suit + +# suporte a internaciolizacao para o Brasil +django-localflavor-br + +# Django Extra Views provides a number of additional class-based generic views to complement those provide by Django itself. +# http://django-extra-views.readthedocs.org/ +# https://github.com/AndrewIngram/django-extra-views +-e git://github.com/AndrewIngram/django-extra-views.git#egg=django-extra-views + diff --git a/{{cookiecutter.repo_name}}/requirements/local.txt b/{{cookiecutter.repo_name}}/requirements/local.txt index 907991351..d282b650e 100644 --- a/{{cookiecutter.repo_name}}/requirements/local.txt +++ b/{{cookiecutter.repo_name}}/requirements/local.txt @@ -8,3 +8,5 @@ Sphinx # django-debug-toolbar that works with Django 1.6 django-debug-toolbar==0.11.0 +# collection of snipplets for django. Utilizado para criacao automatica do usuario admin +django-snippetscream diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py index e7b1c7c0d..f4ef87c0e 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py @@ -13,13 +13,13 @@ https://docs.djangoproject.com/en/dev/ref/settings/ import os from os.path import join -# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings -try: - from S3 import CallingFormat - AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN -except ImportError: - # TODO: Fix this where even if in Dev this class is called. - pass +## See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings +#try: +# from S3 import CallingFormat +# AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN +#except ImportError: +# # TODO: Fix this where even if in Dev this class is called. +# pass from configurations import Configuration, values @@ -40,7 +40,7 @@ class Common(Configuration): # Useful template tags: # 'django.contrib.humanize', - + 'django-suit', # django-admin theme # Admin 'django.contrib.admin', ) @@ -48,6 +48,14 @@ class Common(Configuration): 'south', # Database migration helpers: 'crispy_forms', # Form layouts 'avatar', # for user avatars + 'autocomplete_light', + 'municipios', # for Brazilian cities and states + 'django_localflavor_br', + 'bootstrap_toolkit', + #Bootstrap 3 integration with Django. Easily generate Bootstrap3 compatible HTML using template tags. + #https://github.com/dyve/django-bootstrap3 + 'bootstrap3', + 'extra_views', ) # Apps specific for this project go here. @@ -66,6 +74,14 @@ class Common(Configuration): 'allauth.account', # registration 'allauth.socialaccount', # registration ) + + ########## django-suit + # http://django-suit.readthedocs.org/en/develop/configuration.html + SUIT_CONFIG = { + 'ADMIN_NAME': '{{cookiecutter.repo_name}}' + } + + ########## END django-suit CONFIGURATION ########## END APP CONFIGURATION ########## MIDDLEWARE CONFIGURATION @@ -117,7 +133,8 @@ class Common(Configuration): ########## DATABASE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases - DATABASES = values.DatabaseURLValue('postgres://localhost/{{cookiecutter.repo_name}}') + #DATABASES = values.DatabaseURLValue('postgres://localhost/{{cookiecutter.repo_name}}') + DATABASES = values.DatabaseURLValue('sqlite:////{0}.sqlite'.format(join(BASE_DIR, '{{cookiecutter.repo_name}}'))) ########## END DATABASE CONFIGURATION ########## CACHING @@ -133,10 +150,10 @@ class Common(Configuration): ########## GENERAL CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone - TIME_ZONE = 'America/Los_Angeles' + TIME_ZONE = 'America/Araguaina' # See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code - LANGUAGE_CODE = 'en-us' + LANGUAGE_CODE = 'pt-br' # See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id SITE_ID = 1 @@ -296,6 +313,12 @@ class Local(Common): } ########## end django-debug-toolbar + ########## django-snippetscream - https://github.com/shaunsephton/django-snippetscream + # autocreate a superuser: user: admin , pass: admin + CREATE_DEFAULT_SUPERUSER = True + INSTALLED_APPS += ('snippetscream', ) + ########## end django-snippetscream + ########## Your local stuff: Below this line define 3rd party libary settings @@ -331,32 +354,32 @@ class Production(Common): INSTALLED_APPS += ("gunicorn", ) - ########## STORAGE CONFIGURATION - # See: http://django-storages.readthedocs.org/en/latest/index.html - INSTALLED_APPS += ( - 'storages', - ) + ########### STORAGE CONFIGURATION + ## See: http://django-storages.readthedocs.org/en/latest/index.html + #INSTALLED_APPS += ( + # 'storages', + #) - # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings - STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' + ## See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings + #STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' - # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings - AWS_ACCESS_KEY_ID = values.SecretValue() - AWS_SECRET_ACCESS_KEY = values.SecretValue() - AWS_STORAGE_BUCKET_NAME = values.SecretValue() - AWS_AUTO_CREATE_BUCKET = True - AWS_QUERYSTRING_AUTH = False + ## See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings + #AWS_ACCESS_KEY_ID = values.SecretValue() + #AWS_SECRET_ACCESS_KEY = values.SecretValue() + #AWS_STORAGE_BUCKET_NAME = values.SecretValue() + #AWS_AUTO_CREATE_BUCKET = True + #AWS_QUERYSTRING_AUTH = False - # AWS cache settings, don't change unless you know what you're doing: - AWS_EXPIREY = 60 * 60 * 24 * 7 - AWS_HEADERS = { - 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY, - AWS_EXPIREY) - } + ## AWS cache settings, don't change unless you know what you're doing: + #AWS_EXPIREY = 60 * 60 * 24 * 7 + #AWS_HEADERS = { + # 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY, + # AWS_EXPIREY) + #} - # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url - STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME - ########## END STORAGE CONFIGURATION + ## See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url + #STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME + ########### END STORAGE CONFIGURATION ########## EMAIL DEFAULT_FROM_EMAIL = values.Value( diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py index cf66e9120..cb2a3e618 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py @@ -1,11 +1,15 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.views.generic import TemplateView +import autocomplete_light +autocomplete_light.autodiscover() + # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() @@ -32,3 +36,16 @@ urlpatterns = patterns('', ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + +urlpatterns += patterns('', + url(r'^autocomplete/', include('autocomplete_light.urls')), + +) + +urlpatterns += patterns('', + url(r'^municipios_app/', include('municipios.urls')), +) + + +urlpatterns += staticfiles_urlpatterns() + diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/static/css/project.css b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/static/css/project.css index 5be528645..875fc98d2 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/static/css/project.css +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/static/css/project.css @@ -1 +1,33 @@ /*! project specific CSS goes here. */ + +/* bootstrap alert CSS, translated to the django-standard levels of +** debug, info, success, warning, error */ +.alert-debug { + color: black; + background-color: white; + border-color: #d6e9c6; +} + +.alert-info { + color: #3a87ad; + background-color: #d9edf7; + border-color: #bce8f1; +} + +.alert-success { + color: #468847; + background-color: #dff0d8; + border-color: #d6e9c6; +} + +.alert-warning { + color: black; + background-color: orange; + border-color: #d6e9c6; +} + +.alert-error { + color: #b94a48; + background-color: #f2dede; + border-color: #eed3d7; +} diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html index 8ff4b7be3..54f229b36 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/base.html @@ -28,7 +28,8 @@ {% block angular %} {% endblock %} - + {% block extrahead %} + {% endblock extrahead %} @@ -53,6 +54,12 @@
+ {% if messages %} + {% for message in messages %} +
{{ message }}
+ {% endfor %} + {% endif %} + {% block content %}

Use this document as a way to quick start any new project.

{% endblock content %} @@ -76,6 +83,11 @@ {% endblock javascript %} + {% block autocompleteligth %} + + {% include 'autocomplete_light/static.html' %} + + {% endblock autocompleteligth %} {% endraw %}