I recently deployed a django project to digitalocean. This project has some django apps and implemented django-hosts for subdomain configuration. While this worked well locally, static files could not be found on navigating to the subdomain after deploy to digitalocean.
All the other parts of the websites are styled properly.
Question:
- Is there anything I can do to correct this anomaly?
- Is there any other way to do this without having to use django-hosts.
Here is the website: kingdomleadsafrica.org
The subdomain is: executives.kingdomleadsafrica.org
Thanks
Making a subdomain in django at production is simple and straight forward.
N.B: you don't need any plug in like django-hosts or django-subdomain to make this happen.
What I did with my project is splitting it into two different projects calling them different names.
I put both of the projects in the same projectdir as recommended when deploying single project to digitalocean using nginx and gunicorn.
I created gunicorn.sock and gunicorn.service for each project changing gunicorn to the name of the project e.g if my projects name is blog and forum, I will have blog.sock and blog.service for blog and created corresponding name for the other project.
The same thing will be done for nginx too. You place the domain that you want in the server part of the nginx.
Make sure that you properly fill the directory well especially the gunicorn.service(in this case, blog.service and the other).
Also, if you want to run any command relating to gunicorn, you will the name of your service file.
Remember to include your subdomain in in your settings.py and also create it in your digitalocean as A record
Good luck.