Reputation: 171
i am new user django-pycharm and i want to create a html/css template in the pycharm. my proplem is in the pycharm i cant to connect html file with css file. if i run that files with the classic way out of the pycharm its ok but i cant to connect in the program.
my connect line in the txt files
link href="templatemo_style.css" rel="stylesheet" type="text/css" />
Upvotes: 0
Views: 8256
Reputation: 177
So what I found to work is...
So basically what I did was I manually typed up until I got to the href link and then pressed control+spacebar and it automatically brought up my style.css link for me and did the directory itself. Maybe that would work.
Upvotes: 0
Reputation: 5551
your html code is wrong
<link rel="stylesheet" href="templatermo_style.css">
also check file name, your css file's name is templatermo_style.css
not templatemo_style.css
I recommend you to use static files instead of usual way, check other answers
Upvotes: 0
Reputation: 37876
in django, you need to set up things a little bit, so that django (in local machine) or your web server (if you deploy the code to production) will find and render the static files (they are: css, images and js files) correctly.
here you read how you set it up first in django itself.
at the end, you will have something like this in your html file:
{% load staticfiles %}
<link href="{% static 'css/templatemo_style.css' %}" rel="stylesheet" type="text/css" />
so, your static files dont live directly in the same folder where html files live, but in their own folders, I normally call them site-static
.
and here how you set up PyCharm with Django by the way :) http://www.django-tips.com/tip/how-to-setup-pycharm-for-django/31/
Upvotes: 2
Reputation: 300
There is a type there. The css link says: "templatemo" and the file is called "templatermo".
Upvotes: 0
Reputation: 11906
You need to put your static files inside the static
directory inside your app. Then you should be able to access them using {{ STATIC_URL }}
in your template.
Django Templating is a little different than usual HTML/CSS. You need to put some efforts into learning how the template works and how the static files are served.
Upvotes: 2