Last active
September 7, 2019 09:51
-
-
Save menecio/fe0fdc8b398f80f62774f01df63e6489 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from aiohttp import web | |
from django import setup | |
from django.conf import settings | |
from mymoviedb import settings as my_settings # not the same as django.conf.settings | |
from movies.routes import movies_app | |
async def setup_django(app): | |
''' | |
Configures database and installed apps so | |
we can have Django ORM ready to be used. | |
''' | |
settings.configure( | |
INSTALLED_APPS=my_settings.INSTALLED_APPS, | |
DATABASES=my_settings.DATABASES) | |
setup() | |
app = web.Application() | |
app.on_startup.append(setup_django) | |
app.add_subapp('/api/', movies_app) | |
if __name__ == '__main__': | |
web.run_app(app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment