[Flask] Access to /static (static files) when deployed with cgi
Christopher Zee
christopher.xs.zee at gmail.com
Thu Dec 8 10:58:08 EST 2016
Hi,
You should preferably make the front-end use 'static/' in any hard-coded
links. This way Flask will serve up the appropriate files. As for the IDE
you may look into PyCharm and see if it suits you.
--
Christopher
On 8 December 2016 at 15:42, Per Låås <per.laas at sprakochfolkminnen.se>
wrote:
> 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
>
>
>
> .
>
> --- 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
>
>
>
> +46 18 652 446
>
> per.laas at sprakochfolkminnen.se
>
>
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20161208/b7f88d73/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 27491 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/flask/attachments/20161208/b7f88d73/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 18942 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/flask/attachments/20161208/b7f88d73/attachment-0003.jpg>
More information about the Flask
mailing list