Django not picking up new changes - python

I'm running an old branch A from my GitHub repo, and Django is not picking up any of the static files. What's weird is that if I make any text changes to the templates, it doesn't pick those up either. I've tried refreshing the page, opening Chrome in Incognito, restarting the server, etc. -- nothing is working.
After running the development server in a different branch B, and switching back to this one, Django acted as if I was still running on branch B (got not 404 errors):
$ ./manage.py runserver
0 errors found
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[12/Sep/2012 23:25:48] "GET /interviews/ HTTP/1.1" 200 13295
But as soon as I restarted the server, it reverted to the un-changed version of branch A (none of the changes were picked up and no static files could be found):
$ ./manage.py runserver
Validating models...
0 errors found
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[12/Sep/2012 23:26:20] "GET /interviews/ HTTP/1.1" 200 13295
[12/Sep/2012 23:26:20] "GET /static/js/plugins.js HTTP/1.1" 404 2653
[12/Sep/2012 23:26:20] "GET /static/js/jquery-1.7.1.min.js HTTP/1.1" 404 2653
[12/Sep/2012 23:26:20] "GET /static/css/style.css?v=2 HTTP/1.1" 404 2653
[12/Sep/2012 23:26:20] "GET /static/js/script.js HTTP/1.1" 404 2653
Between the two branches, settings.py and the static folder are identical so I'm not even sure where to begin with troubleshotting.

DEBUG = True
Check this. Built-in Django dev server does not work with static files if DEBUG = False.

Related

python -m SimpleHTTPServer no longer working

python -m SimpleHTTPServer 8000 was working fine in order to render my web pages on localhost. When it quit, I used 7800, which also failed eventually, and now no numerical string works. For example, having launched the server using python -m SimpleHTTPServer 7600, I get the following when trying to render through the browser (any browser):
Serving HTTP on 0.0.0.0 port 7600 ...
127.0.0.1 - - [21/Feb/2022 20:14:04] code 404, message File not found
127.0.0.1 - - [21/Feb/2022 20:14:04] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [21/Feb/2022 20:14:19] code 404, message File not found
127.0.0.1 - - [21/Feb/2022 20:14:19] "GET /FrontandBackMatter/css/style.css HTTP/1.1" 404 -
I get this result having changed nothing in the files.

Using Flask with Google App Engine Dev Server, swagger ui not found?

I am developing a website using Flask and Flask Restplus. I tried to use Google App Engine to deploy the app, however when I run dev_appserver.py on my computer, all the swagger-ui files cannot be found. I have no ideas why this happens? Can anyone tell me how to solve this?
Here is the example logs 404 for the resource:
INFO 2017-06-14 04:21:52,859 module.py:809] default: "GET /api/ HTTP/1.1" 200 3710
INFO 2017-06-14 04:21:53,113 module.py:809] default: "GET /swaggerui/bower/swagger-ui/dist/css/screen.css HTTP/1.1" 404 233
INFO 2017-06-14 04:21:53,113 module.py:809] default: "GET /swaggerui/bower/swagger-ui/dist/lib/jquery.slideto.min.js HTTP/1.1" 404 233
INFO 2017-06-14 04:21:53,115 module.py:809] default: "GET /swaggerui/bower/swagger-ui/dist/lib/object-assign-pollyfill.js HTTP/1.1" 404 233
INFO 2017-06-14 04:21:53,121 module.py:809] default: "GET /swaggerui/bower/swagger-ui/dist/css/typography.css HTTP/1.1" 404 233
You need to put swaggerui inside your project. I suggest making a libs directory at the root of your project (same level as app.yaml).
Then, use GAE's vendoring method. To use vendoring, create (or modify) appengine_config.py in the root of your project, as follows:
from google.appengine.ext import vendor
# Add 3rd party libraries in the "libs" folder.
vendor.add('libs')

Flask can't find/run my app even though its in my Pythonpath

I have a very simple Flask app setup locally but when I try to run it I get this error:
NoAppException: The file/path provided (cowork_map) does not appear to exist. Please verify the path is correct. If app is not on PYTHONPATH, ensure the extension is .py
Im in a virtual env with flask and all other requirements installed and up to date, I have added the path to my project folder to my $PYTHONPATH and have checked that its there.
I have also used the second answer here to force check if its in my sys.path:
How to add something to PYTHONPATH?
I have tried force running it with 'python -m flask run' as advised here
Flask can't find app file
I ran export 'FLASK_APP=myapp.py' as advised in the official docs.
I have also tried running with with 'FLASK_DEBUG=1' and this is the output:
127.0.0.1 - - [05/Mar/2017 16:55:13] "GET /? __debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
127.0.0.1 - - [05/Mar/2017 16:55:13] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
127.0.0.1 - - [05/Mar/2017 16:55:13] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
127.0.0.1 - - [05/Mar/2017 16:55:13] "GET /?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -
127.0.0.1 - - [05/Mar/2017 16:55:13] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
127.0.0.1 - - [05/Mar/2017 16:55:13] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
Whats even stranger is that I have another Flask project folder with its own env and that runs just fine, I can't see whats different with this one though.
I should add that everything in my app file is setup correctly with a Flask app initialized.
Also, if I run 'python -mflask run' (with DEBUG on) I get this error on the page when viewed locally:
__main__.NoAppException
but just 'flask run' displays this:
flask.cli.NoAppException
OK I figured this out, I have both Python 2.7 and 3 on my machine and there was a module I had imported that was installed on the other version of Python to the one I was using in my env. A very noob error I suppose!

Problems with Django static files

I have downloaded this project and trying to make it work: http://sourceforge.net/p/etconf/git/ci/master/tree/
The problem is, after I managed to install all prerequisites, it runs, but does not load staticfiles. According to settings it should look for them in the /media directory, but however I tried to change MEDIA_ROOT, STATIC_URL and various different parameters in settings.py it shows in the console:
[09/Oct/2015 10:56:08] "GET /static/configurator/admin/css/base.css HTTP/1.1" 404 2281
[09/Oct/2015 10:56:08] "GET /static/configurator/configurator.css HTTP/1.1" 404 2275
[09/Oct/2015 10:56:08] "GET /static/configurator/prototype.js HTTP/1.1" 404 2263
[09/Oct/2015 10:56:08] "GET /static/configurator/configurator.js HTTP/1.1" 404 2272
What am I doing wrong? Maybe it's some sort of old bug or something (project is using python 2 and django 1.1)
I guess you missed to run below command after configuration:
python manage.py collectstatic
What I see is you get 404 error for static files which means that the files are not located where it is been searched for.

django errors with img/loading.gif

I dont know why I am getting this error..
[06/Feb/2015 08:04:18] "GET /static/images/bg.png HTTP/1.1" 404 1643
[06/Feb/2015 08:04:18] "GET /static/images/loading.gif HTTP/1.1" 404 1658
[06/Feb/2015 08:04:18] "GET /img/major/main_bg.jpg HTTP/1.1" 404 11090
[06/Feb/2015 08:04:18] "GET /img/loading.gif HTTP/1.1" 404 11072
[06/Feb/2015 08:04:18] "GET /img/a07.png HTTP/1.1" 404 11060
Locally I dont have any problem with this but in deployment it gives alot of problem. My site totally becomes slow and throws internal server error..
Why I am getting this error
perhaps you forgot to runpython manage.py collectstatic on your server.
That dosen't affect the runserver command but the real webserver.

Categories

Resources