Skip to content

Instantly share code, notes, and snippets.

@tonykamillo
Last active November 4, 2016 13:07
Show Gist options
  • Save tonykamillo/ba7651d3a131497ccff2fb88a3f1fbd5 to your computer and use it in GitHub Desktop.
Save tonykamillo/ba7651d3a131497ccff2fb88a3f1fbd5 to your computer and use it in GitHub Desktop.
Sugestão de AppConfig
# -*- coding:utf-8 -*-
# Este é o init do app
import importlib
from django.apps import AppConfig
class PollConfig(AppConfig):
name = 'common.poll' # nome canônico de importação do app
def ready(self):
importlib.import_module('common.poll.loader') # Utilizei a importlib ao invés de import para evitar probelmas com o linter
# importar outras coisas necessárias
default_app_config = 'common.poll.PollConfig'
# -*- coding:utf-8 -*-
from default.views import Application
Application.register_javascript('/%(context)s/static/common/js/poll.js')
# Restante dos carregamento necessário para o app
@tonykamillo
Copy link
Author

O nome do módulo de carregamento é apenas uma sugestão.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment