0

I use django1.10

i reference the official doc https://docs.djangoproject.com/en/1.10/intro/tutorial06/

my project name:mysite

structure:

  • mysite-

         - mysite - urls.py
    
                   -views.py
    
                    ...
    
         - templates - index.html 
    
                     - images 
         - static - mysite - assets - css - main.css
    
                                    - js
    
                                    ...
    

    In my index.html

add

{% load staticfiles % } <link rel="stylesheet" text = 'html/css' href="{% static 'mysite/static/main.css' %}" />

it said i have a Invalid block tag about TemplateSyntaxError <link rel="stylesheet" type = 'text/css' href="{% static 'mysite/static/assets/css/main.css' %}" />

views.py (about static files part) STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), '/mysite/static/', ] STATIC_URL = '/static/' STATIC_ROOT='/mysite/static/'

what's part should i notice?

1 Answer 1

1

Hi dear try to make python manage.py collectstatic... hope it solves your problem 😊

Sign up to request clarification or add additional context in comments.

3 Comments

You have requested to collect static files at the destination location as specified in your settings. This will overwrite existing files! Are you sure you want to do this? is this message normal? how should i choose?
yes i'm sure it will make it work if u are working on a production server or you should specify the current location of the static directory in your settings STATIC_ROOT="/mysite/static/"
Yes that message is normal. You really should do that any time you make any changes or add any other static files to your project. It's just a simple check to make you recheck everything so the django developers don't have a lot of people complaining about lost files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.