This commit is contained in:
Fábio C. Barrionuevo da Luz 2013-11-11 17:27:26 -08:00
commit c78916d9da
11 changed files with 283 additions and 43 deletions

58
.gitignore vendored
View File

@ -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 *.log
*.pot *.pot
*.pyc *.pyc
local_settings.py local_settings.py
repo_name repo_name

View File

@ -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 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!!! It's time to write the code!!!

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
# ubuntu packages dependencies
sudo apt-get install memcached libmemcached-dev libevent-dev

View File

@ -1,5 +1,5 @@
# Bleeding edge Django # Bleeding edge Django
https://github.com/django/django/archive/1.6c1.tar.gz django
# Configuration # Configuration
django-configurations==0.5.1 django-configurations==0.5.1
@ -15,7 +15,7 @@ django-floppyforms==1.1
# Models # Models
South==0.8.2 South==0.8.2
# hack so django-model-utils doesn't override Django 1.6b4 install # hack so django-model-utils doesn't override Django 1.6b4 install
git+git://github.com/pydanny/django-model-utils@d71bf2db7581d91dcc8e0a66fd4859eb8969d256 django-model-utils==1.5.0
# images # images
@ -30,10 +30,32 @@ psycopg2==2.5
# Unicode slugification # Unicode slugification
unicode-slugify==0.1.1 unicode-slugify==0.1.1
django-autoslug==1.7.1 django-autoslug==1.7.1
# Useful things # Useful things
django-avatar==2.0 django-avatar==2.0
# Your custom requirements go here # 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-municipios
# 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

View File

@ -5,6 +5,8 @@ django-discover-runner==0.4
Sphinx Sphinx
# django-debug-toolbar that works with Django 1.5+ # django-debug-toolbar that works with Django 1.6
git+git://github.com/django-debug-toolbar/django-debug-toolbar@7e4ecfd04cfe61b51e1fd6fdf0ce1c800a3ebb3b django-debug-toolbar==0.11.0
# collection of snipplets for django. Utilizado para criacao automatica do usuario admin
django-snippetscream

View File

@ -13,13 +13,13 @@ https://docs.djangoproject.com/en/dev/ref/settings/
import os import os
from os.path import join from os.path import join
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings ## See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
try: #try:
from S3 import CallingFormat # from S3 import CallingFormat
AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN # AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN
except ImportError: #except ImportError:
# TODO: Fix this where even if in Dev this class is called. # # TODO: Fix this where even if in Dev this class is called.
pass # pass
from configurations import Configuration, values from configurations import Configuration, values
@ -40,7 +40,7 @@ class Common(Configuration):
# Useful template tags: # Useful template tags:
# 'django.contrib.humanize', # 'django.contrib.humanize',
'suit', # django-admin theme
# Admin # Admin
'django.contrib.admin', 'django.contrib.admin',
) )
@ -48,6 +48,14 @@ class Common(Configuration):
'south', # Database migration helpers: 'south', # Database migration helpers:
'crispy_forms', # Form layouts 'crispy_forms', # Form layouts
'avatar', # for user avatars '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. # Apps specific for this project go here.
@ -66,6 +74,14 @@ class Common(Configuration):
'allauth.account', # registration 'allauth.account', # registration
'allauth.socialaccount', # 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 ########## END APP CONFIGURATION
########## MIDDLEWARE CONFIGURATION ########## MIDDLEWARE CONFIGURATION
@ -117,7 +133,8 @@ class Common(Configuration):
########## DATABASE CONFIGURATION ########## DATABASE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases # 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 ########## END DATABASE CONFIGURATION
########## CACHING ########## CACHING
@ -133,10 +150,10 @@ class Common(Configuration):
########## GENERAL CONFIGURATION ########## GENERAL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone # 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 # 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 # See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
SITE_ID = 1 SITE_ID = 1
@ -282,6 +299,7 @@ class Local(Common):
########## Mail settings ########## Mail settings
EMAIL_HOST = "localhost" EMAIL_HOST = "localhost"
EMAIL_PORT = 1025 EMAIL_PORT = 1025
EMAIL_BACKEND = values.Value('django.core.mail.backends.console.EmailBackend')
########## End mail settings ########## End mail settings
########## django-debug-toolbar ########## django-debug-toolbar
@ -296,6 +314,12 @@ class Local(Common):
} }
########## end django-debug-toolbar ########## 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 ########## Your local stuff: Below this line define 3rd party libary settings
@ -331,32 +355,32 @@ class Production(Common):
INSTALLED_APPS += ("gunicorn", ) INSTALLED_APPS += ("gunicorn", )
########## STORAGE CONFIGURATION ########### STORAGE CONFIGURATION
# See: http://django-storages.readthedocs.org/en/latest/index.html ## See: http://django-storages.readthedocs.org/en/latest/index.html
INSTALLED_APPS += ( #INSTALLED_APPS += (
'storages', # 'storages',
) #)
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings ## See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' #STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings ## See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
AWS_ACCESS_KEY_ID = values.SecretValue() #AWS_ACCESS_KEY_ID = values.SecretValue()
AWS_SECRET_ACCESS_KEY = values.SecretValue() #AWS_SECRET_ACCESS_KEY = values.SecretValue()
AWS_STORAGE_BUCKET_NAME = values.SecretValue() #AWS_STORAGE_BUCKET_NAME = values.SecretValue()
AWS_AUTO_CREATE_BUCKET = True #AWS_AUTO_CREATE_BUCKET = True
AWS_QUERYSTRING_AUTH = False #AWS_QUERYSTRING_AUTH = False
# AWS cache settings, don't change unless you know what you're doing: ## AWS cache settings, don't change unless you know what you're doing:
AWS_EXPIREY = 60 * 60 * 24 * 7 #AWS_EXPIREY = 60 * 60 * 24 * 7
AWS_HEADERS = { #AWS_HEADERS = {
'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY, # 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY,
AWS_EXPIREY) # AWS_EXPIREY)
} #}
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url ## See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME #STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
########## END STORAGE CONFIGURATION ########### END STORAGE CONFIGURATION
########## EMAIL ########## EMAIL
DEFAULT_FROM_EMAIL = values.Value( DEFAULT_FROM_EMAIL = values.Value(

View File

@ -1,11 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.conf.urls.static import static from django.conf.urls.static import static
from django.views.generic import TemplateView from django.views.generic import TemplateView
import autocomplete_light
autocomplete_light.autodiscover()
# Uncomment the next two lines to enable the admin: # Uncomment the next two lines to enable the admin:
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
@ -32,3 +36,16 @@ urlpatterns = patterns('',
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ) + 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()

View File

@ -1 +1,33 @@
/*! project specific CSS goes here. */ /*! 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;
}

View File

@ -52,12 +52,14 @@
<h2>{% trans "Add E-mail Address" %}</h2> <h2>{% trans "Add E-mail Address" %}</h2>
<form method="post" action="" class="add_email"> <form method="post" action="." class="add_email">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<button class="btn" name="action_add" type="submit">{% trans "Add E-mail" %}</button> <button class="btn" name="action_add" type="submit">{% trans "Add E-mail" %}</button>
</form> </form>
</div>
</div>
</div>
{% endblock %} {% endblock %}
@ -76,4 +78,4 @@
})(); })();
</script> </script>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -0,0 +1,65 @@
{% raw %}{% extends "admin/base.html" %}
{% load admin_static %}
{# Additional <head> content here, some extra meta tags or favicon #}
{#{% block extrahead %}#}
{#{% endblock %}#}
{# Additional CSS includes #}
{#{% block extrastyle %}#}
{# <link rel="stylesheet" type="text/css" href="{% static 'css/my_project.css' %}" media="all">#}
{#{% endblock %}#}
{# Additional JS files in footer, right before </body> #}
{% block extrajs %}
<script type="text/javascript" src="{% static 'js/my_project.js' %}"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.js" type="text/javascript"></script>
{% include 'autocomplete_light/static.html' %}
{% endblock %}
{# Footer links (left side) #}
{#{% block footer_links %}#}
{# <a href="/docs/" class="icon"><i class="icon-question-sign"></i>Documentation</a>#}
{#{% endblock %}#}
{# Additional header content like notifications or language switcher #}
{#{% block header_content %}#}
{# {{ block.super }}#}
{# <div class="header-content">#}
{# <!-- First icon column -->#}
{# <div class="header-column icon">#}
{# <i class="icon-home"></i><br>#}
{# <i class="icon-cog"></i>#}
{# </div>#}
{# <div class="header-column" style="margin-right: 20px">#}
{# <a href="/" class="grey">Front-end</a><br>#}
{# <a href="" class="grey">One more link</a>#}
{# </div>#}
{# <!-- Second icon column -->#}
{# <div class="header-column icon">#}
{# <i class="icon-comment"></i>#}
{# </div>#}
{# <div class="header-column">#}
{# <a href="" class="grey">5 new messages</a>#}
{# </div>#}
{# </div>#}
{#{% endblock %}#}
{# Footer branding name (center) #}
{% block footer_branding %}
SGT - Sistema de Gerenciamento de Transportes
{% endblock %}
{% block footer_links %}
<a href="http://fabiodev.info/support/" target="_blank" class="icon"><i class="icon-question-sign"></i>Suporte</a>
{# <a href="http://djangosuit.com/pricing/" target="_blank" class="icon"><i class="icon-bookmark"></i>Licence</a>#}
<a href="https://bitbucket.org/sgtto/projetoposto/issues" target="_blank" class="icon"><i class="icon-comment"></i>Informe um bug</a>
{% endblock %}
{# Footer copyright (right side) #}
{% block copyright %}
Copyrightleft &copy; 2013 <br> Desenvolvido por <a href="http://fabiodev.info" target="_blank">{% endraw %}{{cookiecutter.author_name}}{% raw %}</a>
{% endblock %}
{% endraw %}

View File

@ -28,7 +28,8 @@
{% block angular %} {% block angular %}
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
{% endblock %} {% endblock %}
{% block extrahead %}
{% endblock extrahead %}
</head> </head>
<body> <body>
@ -53,6 +54,12 @@
<div class="container"> <div class="container">
{% if messages %}
{% for message in messages %}
<div class="alert {% if message.tags %}alert-{{ message.tags }}"{% endif %}>{{ message }}</div>
{% endfor %}
{% endif %}
{% block content %} {% block content %}
<p>Use this document as a way to quick start any new project.</p> <p>Use this document as a way to quick start any new project.</p>
{% endblock content %} {% endblock content %}
@ -76,6 +83,11 @@
<!-- place project specific Javascript in this file --> <!-- place project specific Javascript in this file -->
<script src="{% static 'js/project.js' %}"></script> <script src="{% static 'js/project.js' %}"></script>
{% endblock javascript %} {% endblock javascript %}
{% block autocompleteligth %}
<!--/. autocomplete_light static files-->
{% include 'autocomplete_light/static.html' %}
<!--/. end autocomplete_light static files -->
{% endblock autocompleteligth %}
</body> </body>
</html> </html>
{% endraw %} {% endraw %}