Last active
November 4, 2016 13:07
-
-
Save tonykamillo/ba7651d3a131497ccff2fb88a3f1fbd5 to your computer and use it in GitHub Desktop.
Sugestão de AppConfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
O nome do módulo de carregamento é apenas uma sugestão.