[Flask] Access to /static (static files) when deployed with cgi

Per Låås per.laas at sprakochfolkminnen.se
Thu Dec 8 09:42:26 EST 2016


Hi!

I am new to flask and have deployed a flask web application based on a flask demo-project with cgi: ScriptAlias /flaskutforskning /path/flaskutforskning/flaskutforskning.cgi in production on the linux server, deployed following instructions at http://flask.pocoo.org/docs/0.11/deploying/cgi/. Se also file tree below.

I run the development-server in Visual Studio in my PC using from runserver.py, created by the VS Python tools - Flask web project, which I guess uses WSGI. See screen images below.

The application works fine except the links to static-files are different in development in Visual Studio and in production on the linux server. See file hierarchy below.

Development-server in Visual Studio in my PC
http://localhost:PORT/static/scripts/SPAshowresult.js

In production server:
http://www.mydomain.com/flaskutforskning/flaskutforskning/static/scripts/SPAshowresult.js

Questions:

·         Does anybody have a suggestion how to find a better way to work with paths so there is the same static path in dev and production?

·         Is there a better IDE than Visual Studio for development and debugging in the code, step by step?

Thank you so much in advance.

Best regards,

Per Låås

[cid:image002.jpg at 01D25169.ACDFA6C0]
[cid:image004.jpg at 01D25169.ACDFA6C0]
.
--- flaskutforskning
-- -  --- __init__.py
-- -  --- static
-- -  -- -  --- content
-- -  -- -  -- -  --- bootstrap.css
-- -  -- -  -- -  --- bootstrap.min.css
-- -  -- -  -- -  --- site.css
-- -  -- -  --- fonts
-- -  -- -  -- -  --- glyphicons-halflings-regular.eot
-- -  -- -  -- -  --- glyphicons-halflings-regular.svg
-- -  -- -  -- -  --- glyphicons-halflings-regular.ttf
-- -  -- -  -- -  --- glyphicons-halflings-regular.woff
-- -  -- -  --- scripts
-- -  -- -      --- autocomplete.js
-- -  -- -      --- bootstrap.js
-- -  -- -      --- bootstrap.min.js
-- -  -- -      --- jquery-1.10.2.intellisense.js
-- -  -- -      --- jquery-1.10.2.js
-- -  -- -      --- jquery-1.10.2.min.js
-- -  -- -      --- jquery-1.10.2.min.map
-- -  -- -      --- jquery.validate.js
-- -  -- -      --- jquery.validate.min.js
-- -  -- -      --- jquery.validate.unobtrusive.js
-- -  -- -      --- jquery.validate.unobtrusive.min.js
-- -  -- -      --- jquery.validate-vsdoc.js
-- -  -- -      --- modernizr-2.6.2.js
-- -  -- -      --- _references.js
-- -  -- -      --- respond.js
-- -  -- -      --- respond.min.js
-- -  -- -      --- SPAshowresult.js
-- -  --- templates
-- -  -- -  --- about.html
-- -  -- -  --- contact.html
-- -  -- -  --- dynfragasr.html
-- -  -- -  --- dynfrageladan - Copy.html
-- -  -- -  --- dynfrageladan.html
-- -  -- -  --- extendslayout.html
-- -  -- -  --- fragasr.html
-- -  -- -  --- frageladan - Copy (2).html
-- -  -- -  --- frageladan - Copy.html
-- -  -- -  --- frageladan.html
-- -  -- -  --- frageladan_origSPA.html
-- -  -- -  --- index.html
-- -  -- -  --- layout.html
-- -  -- -  --- test.html
-- -  --- utils.py
-- -  --- views.py
-- -  --- views - test.py
--- flaskutforskning.cgi
--- svnupdate.log
--- svnupdate.sh

6 directories, 45 files


--
Per Låås
Developer
Institutet för språk och folkminnen
www.sprakochfolkminnen.se<http://www.sprakochfolkminnen.se/>

+46 18 652 446
per.laas at sprakochfolkminnen.se<mailto:per.laas at sprakochfolkminnen.se>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20161208/1c439e34/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 18942 bytes
Desc: image002.jpg
URL: <http://mail.python.org/pipermail/flask/attachments/20161208/1c439e34/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 27491 bytes
Desc: image004.jpg
URL: <http://mail.python.org/pipermail/flask/attachments/20161208/1c439e34/attachment-0003.jpg>


More information about the Flask mailing list