用Django-host创建的子域,未针对生产
我最近向Digitalocean部署了一个Django项目。该项目具有一些Django应用程序,并实现了用于子域配置的Django-Hosts。 虽然在本地运行良好,但是在部署到Digitalocean后导航到子域时找不到静态文件。
网站的所有其他部分都适当地进行了设计。
问题:
- 我有什么能做纠正这种异常现象的事情吗?
- 还有其他方法可以这样做,而无需使用Django-Hosts。
这是网站: akingdomleadsafrica.org
子域是: 高管.kingdomleadsafrica.org
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
生产时在Django中制作子域是简单而直接的。
NB:您不需要任何插件,例如Django-Hosts或Django-Subdomain来实现这一目标。
我对项目所做的工作是将其分为两个不同的项目,称它们为不同的名称。
我将两个项目都放在同一项目中,与使用Nginx和Gunicorn部署单个项目为Digitalocean时所建议的。
我创建了gunicorn.sock and Gunicorn.Service的每个项目的服务,将Gunicorn更改为项目的名称,例如,如果我的项目名称是博客和论坛,我将拥有blog.sock and Blog.service.service。 。
Nginx也会做同样的事情。您将想要的域放置在Nginx的服务器部分。
确保您正确地填充了目录,尤其是Gunicorn.Service(在这种情况下为Blog.Service和其他)。
另外,如果您想运行与枪支有关的任何命令,则将您的服务文件的名称。
请记住,将您的子域纳入您的设置中
。
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.