大网数据广告活动
服务器运维问答

Urls.py not updating on Django production server , which uses nginx and gunicorn

· 52CE 我爱测

I am currently hosting a Django Webapp on an AWS EC2 instance, To run it in production mode I use NGINX and gunicorn. The Error that I am facing is: The production server doesnt seem to update urls.py, no matter what I do App use…

问题原文

原帖链接 · Madhav · CC BY-SA 4.0

I am currently hosting a Django Webapp on an AWS EC2 instance, To run it in production mode I use NGINX and gunicorn.

The Error that I am facing is:

The production server doesnt seem to update urls.py, no matter what I do

App used to transfer files from local file to instance : FileZilla

Steps that I have taken trying to solve the issue:

  1. Deleting the urls.py and rewriting it

  2. Checking if other files also refuse to get updated

    RESULT of 2nd step: Other files are successfully getting updated, I tested with static files and with index.html

  3. Checking if the file is updated in the instance using The nano editor

    RESULT of 3rd step: The file is properly updated in the instance, with all changes being reflected

  4. Running it on the instance using python manage.py runserver (for development purposes), and found out that the urls.py is getting updated properly when using runserver

Other Information:

1.Everything was getting updated properly just yesterday, but suddenly it decides to act rebellious

  1. I have updated all packages using sudo yum install

  2. I have restarted nginx and gunicorn: using commands such as :

    sudo systemctl start gunicorn

    sudo systemctl enable gunicorn

    sudo systemctl restart nginx

  3. I have tried checking for errors using sudo nginx -t, but no errors show up

  4. I've checked the error logs, using sudo tail -f /var/log/nginx/error.log , but no errors show
    up here either

How do I solve this?

Thank you

已采纳解答

原帖链接 · Madhav · CC BY-SA 4.0

Ok so I found the solution.

Steps taken to solve it:

  1. I tried to use python3 manage.py runserver on my instance, and found out that the files were updated fine , therefore the issue was with the production side

  2. I figured out that only static and html files were being updated (nginx serves those) , so the problem was not with that

  3. I was using gunicorn to help with the views.py and urls.py and other such files, so the problem could be with gunicorn

FINAL SOLUTION:

So I ran the command sudo systemctl restart gunicorn, and the code worked perfectly

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-09-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。