PyCharm and CSS

Answered

crazy story, I start a project, first things first, I set up a stylesheet (I'm using flask). I have done projects with pycharm before but I deleted them just because they were random and junk files, so comepletely clean pycharm projects folder before beginning this one. so I use a style in my html that I created in my style sheet. It does not work. I view the source code using Chrome and I see that the href of my stylesheet link is correct but then I click the link to the file within Chrome and it shows me a stylesheet from a previous project that has already been completely deleted from my computer. Not only is it deleted off my computer but when it was on my computer it was stored in a completely seperate project folder. To reference my stylesheet I am using the code  <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}"> I thought maybe I messed up a setting but I did a clean install of PyCharm with no luck.

6 comments
Comment actions Permalink

Can you try running Flask from the command line, outside of PyCharm? Also, make sure the interpreter used in the Run Configuration matches what you expect.

0
Comment actions Permalink

I ran it from the command line like you suggested and it seemed to work for a short time. The next problem came when I updated my stylesheet, simply changing a font size. I viewed the source code and went into the linked css file like before only to realize the stylesheet the website is running with isnt changing with my edits. This happens when running from PyCharm and from the command line.

0
Comment actions Permalink

Can you create a reproducible example and push to a repo?

0
Comment actions Permalink

Here it is https://github.com/Stripekit/TaylorPhotography I maybe integrating bootstrap into my project might have created problems but this is just simple text with a stylesheet and I run into the same problem.

0
Comment actions Permalink

Paul, I still seem to be coming across the same problems when I run the website from PyCharm or the command line. Do you have any suggestions on what I should do?

0
Comment actions Permalink

I believe this is a known problem with the cache headers being set by Flask. I gave it a try without PyCharm involved, just serving it from the command line. My CSS edits were not reflected unless I reloaded the tab pointed at the CSS file.

0

Please sign in to leave a comment.