2đź‘Ť
Whichever service you are using, do a full stop and a full start (i.e., not just restart).
sudo service apache2 stop
sudo service apache2 start
If you are using uwsgi or gunicorn, you will have to do the same for them. Some init scripts when issuing restart
do not restart the master worker process which might cause a cached compiled version of your file to still reside in memory (with the incorrect code).
0đź‘Ť
With the help of @2ps I was able to figure out my problem. When I tried to stop Apache, the website was still up.
I realized there’s another IP address for the website, so I’m guessing the first one must redirect to the second one?
Either way, I reopened SSH in the other IP address, restarted Apache and the source code updated immediately!
UPDATE:
As per @VidyaSagar request, I’m providing more info as it seems to be a weird fluke with Django. My OP was that a certain line of code was causing an error. I commented out this line, deleted the .pyc
file, and restarted Apache. Another error occurred (as expected due to the code). So then I un-commented that line back to how it was previously, again deleted the .pyc
and restarted Apache, and the system worked like normal. It seems that Django just wanted me to have a fresh re-compile of the file?
Django version: 1.7.4
Traceback of django.log
ERROR Internal Server Error: /upload/
Traceback (most recent call last):
File "/home/company/app/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/company/app/app/geo_app/views.py", line 306, in upload
shutil.make_archive(kml_dir, 'zip', root_dir=kml_dir)
File "/usr/lib/python2.7/shutil.py", line 521, in make_archive
save_cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
ERROR Internal Server Error: /upload/
Traceback (most recent call last):
File "/home/company/app/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/company/app/app/geo_app/views.py", line 306, in upload
# shutil.make_archive(kml_dir, 'zip', root_dir=kml_dir)
File "/usr/lib/python2.7/shutil.py", line 521, in make_archive
save_cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
- [Answered ]-Django makemigrations does not work
- [Answered ]-Adding Additional Hallo.js formatting features to Wagtail CMS RichTextField
0đź‘Ť
For those of you with cPanel, if you go under “Setup Python App” and click “Restart” it should update. Saved me about 5 times.
- [Answered ]-Stripe – 'exp_month' parameter should be an integer (instead, is 02 ) in Django View
- [Answered ]-NgInit not working properly with AngularJS and Django
- [Answered ]-Django Model Admin with FileField cannot read file in save_model after reading file when validating
- [Answered ]-JQuery/Django Syntax error