[Answer]-Dynamically deploy django admin app

0đź‘Ť

âś…

First, Python/Django does not provide a “drop-in” deploy function by themselves, nor I know any way of doing something similar to war packages.

There are services that provide easy deploy methods like Heroku, but I recommend reading Django’s official documentation about deploying for starters.

My target is to setup a Python/Django webserver and dynamically create
Django admin webapp’s, automatically hot deploying them to the
webserver. So, I’d initially setup the web server stuff once and have
a ready http://myserver.com. When user A generated a webappA01, it
would be transparently available in
http://myserver.com/userA/webappA01.

Sounds like what you want to do can be accomplished with custom AdminSite instances.
Basically, you can write a view that instantiates an AdminSite instance named “webapp” (you can pull those parameters from the url of course, and check if the webapp data exists on the database). You’ll need to connect any models you want to that AdminSite instance either from that view or by overriding its init method. The autodiscover function of the Django admin may not work for custom admin sites.

👤Gonzalo

1đź‘Ť

Modern approach is to use uwsgi with Apache or NGINX (I recommend this one).
I don’t know a tool which will auto-deploy your Django app. There are many web services like Heroku which deploy your app automatically (you supply just your VCS repository).

You can deploy your Django app semi-automatically by writing some scripts that will sync your code base, apply migrations for the db and reload web server. Check fabric or Buildbot.

👤nickzam

Leave a comment