mirror of https://github.com/interlegis/sigi.git
Sesostris Vieira
3 years ago
12 changed files with 152 additions and 2455 deletions
@ -1,4 +1 @@ |
|||
Sesostris Viera / @SesostrisVieira |
|||
Breno Teixeira / @Breno_tx |
|||
Marcio Mazza / @marciomazza |
|||
Gilson Filho / @gilsonfilho |
|||
See https://github.com/interlegis/sigi/graphs/contributors |
|||
|
File diff suppressed because it is too large
@ -1,10 +1,22 @@ |
|||
#!/usr/bin/env python |
|||
"""Django's command-line utility for administrative tasks.""" |
|||
import os |
|||
import sys |
|||
|
|||
if __name__ == "__main__": |
|||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sigi.settings") |
|||
|
|||
def main(): |
|||
"""Run administrative tasks.""" |
|||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sigi.settings') |
|||
try: |
|||
from django.core.management import execute_from_command_line |
|||
|
|||
except ImportError as exc: |
|||
raise ImportError( |
|||
"Couldn't import Django. Are you sure it's installed and " |
|||
"available on your PYTHONPATH environment variable? Did you " |
|||
"forget to activate a virtual environment?" |
|||
) from exc |
|||
execute_from_command_line(sys.argv) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
|||
|
@ -0,0 +1,16 @@ |
|||
""" |
|||
ASGI config for sigi project. |
|||
|
|||
It exposes the ASGI callable as a module-level variable named ``application``. |
|||
|
|||
For more information on this file, see |
|||
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ |
|||
""" |
|||
|
|||
import os |
|||
|
|||
from django.core.asgi import get_asgi_application |
|||
|
|||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sigi.settings') |
|||
|
|||
application = get_asgi_application() |
@ -1,13 +1,12 @@ |
|||
try: |
|||
from prod import * |
|||
from sigi.settings.production import * |
|||
except ImportError: |
|||
from django.core.exceptions import ImproperlyConfigured |
|||
msg = """ |
|||
|
|||
###################################################################### |
|||
Arquivo prod.py (django settings) nao encontrado. |
|||
Arquivo production.py (django settings) nao encontrado. |
|||
Se vc esta num ambiente de desenvolvimento pode cria-lo com |
|||
ln -s dev.py prod.py |
|||
ln -s development.py production.py |
|||
###################################################################### |
|||
""" |
|||
raise ImproperlyConfigured(msg) |
|||
|
@ -1,199 +1,81 @@ |
|||
# -*- coding: utf-8 -*- |
|||
""" |
|||
Django settings for sigi project. |
|||
Django base settings for sigi project. |
|||
|
|||
Generated by 'django-admin startproject' using Django 4.0.1. |
|||
|
|||
For more information on this file, see |
|||
https://docs.djangoproject.com/en/dev/topics/settings/ |
|||
https://docs.djangoproject.com/en/4.0/topics/settings/ |
|||
|
|||
For the full list of settings and their values, see |
|||
https://docs.djangoproject.com/en/dev/ref/settings/ |
|||
https://docs.djangoproject.com/en/4.0/ref/settings/ |
|||
""" |
|||
|
|||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
|||
import os |
|||
from os.path import dirname |
|||
|
|||
import django.conf.global_settings as DEFAULT_SETTINGS |
|||
|
|||
BASE_DIR = dirname(dirname(dirname(__file__))) |
|||
|
|||
# Quick-start development settings - unsuitable for production |
|||
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ |
|||
from pathlib import Path |
|||
|
|||
ALLOWED_HOSTS = [] |
|||
# Build paths inside the project like this: BASE_DIR / 'subdir'. |
|||
BASE_DIR = Path(__file__).resolve().parent.parent |
|||
|
|||
ADMINS = ( |
|||
# ('Your Name', 'your_email@example.com'), |
|||
) |
|||
|
|||
MANAGERS = ADMINS |
|||
|
|||
SITE_ID = 1 |
|||
|
|||
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + ( |
|||
'django.core.context_processors.request', |
|||
) |
|||
# 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', |
|||
) |
|||
|
|||
# Application definition |
|||
INSTALLED_APPS = ( |
|||
|
|||
'bootstrap3', |
|||
'django_admin_bootstrapped', |
|||
|
|||
INSTALLED_APPS = [ |
|||
'django.contrib.admin', |
|||
'django.contrib.auth', |
|||
'django.contrib.contenttypes', |
|||
'django.contrib.sessions', |
|||
'django.contrib.messages', |
|||
'django.contrib.staticfiles', |
|||
] |
|||
|
|||
# Local apps |
|||
'sigi.apps.home', |
|||
'sigi.apps.contatos', |
|||
'sigi.apps.servidores', |
|||
'sigi.apps.parlamentares', |
|||
'sigi.apps.casas', |
|||
'sigi.apps.convenios', |
|||
'sigi.apps.inventario', |
|||
'sigi.apps.servicos', |
|||
'sigi.apps.metas', |
|||
'sigi.apps.ocorrencias', |
|||
'sigi.apps.financeiro', |
|||
'sigi.apps.diagnosticos', |
|||
'sigi.apps.eventos', |
|||
'sigi.apps.whois', |
|||
|
|||
# Third-party apps |
|||
'localflavor', |
|||
'reporting', |
|||
'django_extensions', |
|||
'easy_thumbnails', |
|||
'image_cropping', |
|||
'rest_framework', |
|||
'tinymce', |
|||
) |
|||
|
|||
MIDDLEWARE_CLASSES = ( |
|||
MIDDLEWARE = [ |
|||
'django.middleware.security.SecurityMiddleware', |
|||
'django.contrib.sessions.middleware.SessionMiddleware', |
|||
'django.middleware.common.CommonMiddleware', |
|||
'django.middleware.csrf.CsrfViewMiddleware', |
|||
'django.contrib.auth.middleware.AuthenticationMiddleware', |
|||
'django.contrib.messages.middleware.MessageMiddleware', |
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|||
) |
|||
] |
|||
|
|||
ROOT_URLCONF = 'sigi.urls' |
|||
|
|||
TEMPLATES = [ |
|||
{ |
|||
'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|||
'DIRS': [], |
|||
'APP_DIRS': True, |
|||
'OPTIONS': { |
|||
'context_processors': [ |
|||
'django.template.context_processors.debug', |
|||
'django.template.context_processors.request', |
|||
'django.contrib.auth.context_processors.auth', |
|||
'django.contrib.messages.context_processors.messages', |
|||
], |
|||
}, |
|||
}, |
|||
] |
|||
|
|||
WSGI_APPLICATION = 'sigi.wsgi.application' |
|||
|
|||
|
|||
# Internationalization |
|||
# https://docs.djangoproject.com/en/dev/topics/i18n/ |
|||
LANGUAGE_CODE = 'pt-br' |
|||
# https://docs.djangoproject.com/en/4.0/topics/i18n/ |
|||
|
|||
LANGUAGE_CODE = 'en-us' |
|||
|
|||
TIME_ZONE = 'UTC' |
|||
|
|||
USE_I18N = True |
|||
USE_L10N = True |
|||
USE_THOUSAND_SEPARATOR = True |
|||
TIME_ZONE = "America/Sao_Paulo" |
|||
|
|||
gettext_noop = lambda s: s # for gettext discovery |
|||
LANGUAGES = ( |
|||
('en', gettext_noop('English')), |
|||
('pt-br', gettext_noop('Brazilian Portuguese')), |
|||
) |
|||
USE_TZ = True |
|||
|
|||
# Static files (CSS, JavaScript, Images) |
|||
# https://docs.djangoproject.com/en/dev/howto/static-files/ |
|||
STATIC_ROOT = os.path.join(BASE_DIR, 'static') |
|||
STATIC_URL = '/static/' |
|||
STATICFILES_DIRS = ( |
|||
os.path.join(BASE_DIR, 'sigiStatic'), |
|||
) |
|||
|
|||
SERVER_EMAIL = 'sigi@interlegis.leg.br' |
|||
DEFAULT_FROM_EMAIL = 'spdt@interlegis.leg.br' |
|||
EMAIL_SUBJECT_PREFIX = u'[SIGI]' |
|||
|
|||
TEMPLATE_DIRS = ( |
|||
os.path.join(BASE_DIR, 'templates'), |
|||
) |
|||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') |
|||
MEDIA_URL = '/media/' |
|||
|
|||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True |
|||
|
|||
LOGIN_REDIRECT_URL = '/' |
|||
LOGIN_URL = '/login/' |
|||
|
|||
# Using pytest directly (without a test runner) |
|||
TEST_RUNNER = None |
|||
|
|||
from easy_thumbnails.conf import Settings as thumbnail_settings |
|||
THUMBNAIL_PROCESSORS = ( |
|||
'image_cropping.thumbnail_processors.crop_corners', |
|||
) + thumbnail_settings.THUMBNAIL_PROCESSORS |
|||
|
|||
THUMBNAIL_ALIASES = { |
|||
'': { |
|||
'small': {'size': (300, 225), 'crop': True, }, |
|||
'thumb': {'size': (160, 120), 'crop': True, }, |
|||
'portrait': {'size': (73,100), 'crop': True}, |
|||
'icon': {'size': (36,50), 'crop': True}, |
|||
}, |
|||
} |
|||
IMAGE_CROPPING_SIZE_WARNING = True |
|||
IMAGE_CROPPING_THUMB_SIZE = (800, 600) |
|||
|
|||
LOGGING = { |
|||
'version': 1, |
|||
'disable_existing_loggers': False, |
|||
'filters': { |
|||
'require_debug_false': { |
|||
'()': 'django.utils.log.RequireDebugFalse' |
|||
} |
|||
}, |
|||
'handlers': { |
|||
'mail_admins': { |
|||
'level': 'ERROR', |
|||
'class': 'django.utils.log.AdminEmailHandler', |
|||
'include_html': True, |
|||
'filters': ['require_debug_false'], |
|||
}, |
|||
'file': { |
|||
'level': 'DEBUG', |
|||
'class': 'logging.FileHandler', |
|||
'filename': '/var/log/sigi/application.log', |
|||
}, |
|||
}, |
|||
'loggers': { |
|||
'django.request': { |
|||
'handlers': ['mail_admins', 'file'], |
|||
'level': 'ERROR', |
|||
'propagate': True, |
|||
}, |
|||
}, |
|||
} |
|||
|
|||
OSTICKET_URL = 'https://suporte.interlegis.leg.br/scp/tickets.php?a=search&query=%s' |
|||
# Static files (CSS, JavaScript, Images) |
|||
# https://docs.djangoproject.com/en/4.0/howto/static-files/ |
|||
|
|||
REST_FRAMEWORK = { |
|||
# Use Django's standard `django.contrib.auth` permissions, |
|||
# or allow read-only access for unauthenticated users. |
|||
'DEFAULT_PERMISSION_CLASSES': [ |
|||
'rest_framework.permissions.AllowAny', |
|||
] |
|||
} |
|||
STATIC_URL = 'static/' |
|||
|
|||
# Lista de endereços IP que podem acessar a API de whois |
|||
WHOIS_WHITELIST = [ |
|||
'127.0.0.1', |
|||
] |
|||
# Default primary key field type |
|||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field |
|||
|
|||
# TinyMCE configuration |
|||
TINYMCE_SPELLCHECKER = True |
|||
TINYMCE_COMPRESSOR = True |
|||
TINYMCE_DEFAULT_CONFIG = { |
|||
'theme': "advanced", |
|||
"height": 500, |
|||
} |
|||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
|||
|
@ -1,31 +0,0 @@ |
|||
from base import * |
|||
|
|||
# SECURITY WARNING: keep the secret key used in production secret! |
|||
SECRET_KEY = '0$ip1fb5xtq%a=)-k_4r^(#jn0t^@+*^kihkxkozg-mip7+w3+' |
|||
|
|||
DATABASES = { |
|||
'default': { |
|||
'ENGINE': 'django.db.backends.postgresql_psycopg2', |
|||
'NAME': 'sigi', |
|||
'USER': 'sigi', |
|||
'PASSWORD': 'sigi', |
|||
'HOST': 'localhost', |
|||
}, |
|||
} |
|||
|
|||
# SECURITY WARNING: don't run with debug turned on in production! |
|||
DEBUG = True |
|||
TEMPLATE_DEBUG = DEBUG |
|||
DEBUG_TOOLBAR_CONFIG = { |
|||
'SHOW_TEMPLATE_CONTEXT': True, |
|||
} |
|||
|
|||
INSTALLED_APPS += ( |
|||
'debug_toolbar', |
|||
) |
|||
|
|||
CACHES = { |
|||
'default': { |
|||
'BACKEND': 'django.core.cache.backends.dummy.DummyCache', |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
from sigi.settings.base import * |
|||
|
|||
# Quick-start development settings - unsuitable for production |
|||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ |
|||
|
|||
# SECURITY WARNING: keep the secret key used in production secret! |
|||
SECRET_KEY = 'django-insecure-z%cw$-jyh13g2an=8r5ltkyub75bfc$34o(k#%jncdcdgr2$3#' |
|||
|
|||
# SECURITY WARNING: don't run with debug turned on in production! |
|||
DEBUG = True |
|||
|
|||
ALLOWED_HOSTS = [] |
|||
|
|||
|
|||
# Database |
|||
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases |
|||
|
|||
DATABASES = { |
|||
'default': { |
|||
'ENGINE': 'django.db.backends.postgresql_psycopg2', |
|||
'NAME': 'sigi', |
|||
'USER': 'sigi', |
|||
'PASSWORD': '123456', |
|||
'HOST': 'database', |
|||
} |
|||
} |
|||
|
|||
|
|||
# Password validation |
|||
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators |
|||
|
|||
AUTH_PASSWORD_VALIDATORS = [ |
|||
{ |
|||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
|||
}, |
|||
{ |
|||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
|||
}, |
|||
{ |
|||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
|||
}, |
|||
{ |
|||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
|||
}, |
|||
] |
@ -1,22 +0,0 @@ |
|||
from base import * |
|||
|
|||
|
|||
# SECURITY WARNING: keep the secret key used in production secret! |
|||
SECRET_KEY = '0$ip1fb5xtq%a=)-k_4r^(#jn0t^@+*^kihkxkozg-mip7+w3+' |
|||
|
|||
DATABASES = { |
|||
'default': { |
|||
'ENGINE': 'django.db.backends.postgresql_psycopg2', |
|||
'NAME': 'sigi', # will be actually used as "test_sigi" by pytest-django |
|||
'USER': 'sigi', |
|||
'PASSWORD': 'sigi', |
|||
'HOST': 'localhost', |
|||
'PORT': '5432', |
|||
} |
|||
} |
|||
|
|||
# Validate arguments in django-dynamic-fixture |
|||
# http://django-dynamic-fixture.readthedocs.org/en/latest/more.html?highlight=ddf_validate_args#validate-arguments-new-in-1-5-0 |
|||
DDF_VALIDATE_ARGS = True |
|||
DDF_DEBUG_MODE = True |
|||
DDF_DEFAULT_DATA_FIXTURE = 'sigi.testutils.SigiDataFixture' |
@ -1,42 +1,21 @@ |
|||
#-*- coding:utf-8 -*- |
|||
from django.conf import settings |
|||
from django.conf.urls import patterns, include, url |
|||
from django.conf.urls.static import static |
|||
from django.contrib import admin |
|||
from django.views.generic.base import TemplateView |
|||
|
|||
admin.site.index_template = 'index.html' |
|||
admin.autodiscover() |
|||
|
|||
urlpatterns = patterns( |
|||
'', |
|||
|
|||
url(r'^parlamentares/', include('sigi.apps.parlamentares.urls')), |
|||
url(r'^casas/', include('sigi.apps.casas.urls')), |
|||
url(r'^convenios/', include('sigi.apps.convenios.urls')), |
|||
url(r'^diagnosticos/', include('sigi.apps.diagnosticos.urls')), |
|||
url(r'^servicos/', include('sigi.apps.servicos.urls')), |
|||
url(r'^dashboard/', include('sigi.apps.metas.urls')), |
|||
url(r'^ocorrencias/', include('sigi.apps.ocorrencias.urls')), |
|||
url(r'^eventos/', include('sigi.apps.eventos.urls')), |
|||
url(r'^whois/', include('sigi.apps.whois.urls')), |
|||
url(r'^tinymce/', include('tinymce.urls')), |
|||
url(r'^', include('sigi.apps.home.urls')), |
|||
url(r'^', include(admin.site.urls)), |
|||
"""sigi URL Configuration |
|||
|
|||
# to enable language selection |
|||
# Suspended |
|||
#url(r'^i18n/', include('django.conf.urls.i18n')), |
|||
|
|||
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |
|||
|
|||
if settings.DEBUG: |
|||
urlpatterns = patterns( |
|||
'', |
|||
The `urlpatterns` list routes URLs to views. For more information please see: |
|||
https://docs.djangoproject.com/en/4.0/topics/http/urls/ |
|||
Examples: |
|||
Function views |
|||
1. Add an import: from my_app import views |
|||
2. Add a URL to urlpatterns: path('', views.home, name='home') |
|||
Class-based views |
|||
1. Add an import: from other_app.views import Home |
|||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') |
|||
Including another URLconf |
|||
1. Import the include() function: from django.urls import include, path |
|||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) |
|||
""" |
|||
from django.contrib import admin |
|||
from django.urls import path |
|||
|
|||
url(r'^404/$', TemplateView.as_view(template_name='404.html')), |
|||
url(r'^500/$', TemplateView.as_view(template_name='500.html')), |
|||
url(r'^503/$', TemplateView.as_view(template_name='503.html')), |
|||
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { |
|||
'document_root': settings.MEDIA_ROOT, }), |
|||
) + urlpatterns |
|||
urlpatterns = [ |
|||
path('admin/', admin.site.urls), |
|||
] |
|||
|
Loading…
Reference in new issue