markfinger / python-react

Server-side rendering of React components
MIT License
1.62k stars 116 forks source link

Use AppConfig class instead of implicit models.py #45

Closed mjtamlyn closed 9 years ago

mjtamlyn commented 9 years ago

As of django 1.6 models.py files are not needed and you can use an AppConfig.ready() to do explicit setup.

markfinger commented 9 years ago

I'm not too familiar with the AppConfig stuff - is there a standard for automatic discovery?

In this project, models.py is only really a hook so that react.conf.settings can be configured declaratively from django's settings files. It's a bit of a hack, which used to be necessary due to circular imports - not sure if it's still necessary though.

More than happy to accept to a PR

mjtamlyn commented 9 years ago

See https://github.com/django/django/blob/master/django/contrib/gis/__init__.py as an example of the auto discovery - put a dotted path to the app config as default_app_config at the module level.

The app config's are there specifically for this use case so it doesn't need to be a hack.