Django can't find the static files

django models
django model fields
django queryset
django tutorial
django orm
django-filter
django documentation
django models tutorial

I just started a new project and currently Django can't find the static files. I'm using Django==2.2.6

The static files are located in an app called "website". This is the file structure.

https://i.imgur.com/AnPACop.png

This is from the settings:

STATIC_URL = '/static/'

This is how i include the static file:

{% static 'css/style.css' %}

The URL to the static file seems correct:

<link href="/static/css/style.css" rel="stylesheet">

EDIT: its NOT correct. But this works:

<link href="/static/core/css/style.css" rel="stylesheet">

This is the URL that the browser will find your static files. It won't let Django know in which folder to find them inside your project root (`BASE_DIR)

STATIC_URL = '/static/'

Try using this instead to specify the directory you are storing the statics

STATICFILES_DIRS = (os.path.join(BASE_DIR, 'website/static'),)

Also, make sure you are loading the statics in your template with the following template tag

{% load static %}
Update

The path to the CSS is also wrong on the html you should change it to:

<link href="/static/core/css/style.css" rel="stylesheet">

Models | Django documentation, You can easily write your own fields if Django's built-in ones don't do the trick; see Writing custom model fields. Field options¶. Each field takes a certain set of field-  Django is a high-level Python framework designed for rapid, secure, and scalable web development. Django includes rich support for URL routing, page templates, and working with data. In this Django tutorial, you create a simple Django app with three pages that use a common base template.


Make Your File Structure Like

ProjectFolderName
   static
      -css
      -js ..
   template
   website
   projectfoldername
   migration...

Better Put Your Static folder in Your Project Folder. Then Make Change To Your settings.py in projectfoldername with-

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR,'static')
]
STATIC_ROOT = os.path.join(BASE_DIR, 'assets')

Then Run this command

python manage.py collectstatic

You static file will be copied to New file created by django as assets. and add to your HTML

{{% load static %}} 

The Django template language | Django documentation, We wanted Django's template language to be usable for more than just XML/​HTML templates. At World Online, we use it for emails, JavaScript and CSV. You can  You can have a list of email addresses and their respective names. Then you can modify the message and send emails to the target audience automatically. 2. Login System in Django. Project idea – Implement a basic template of a login system and then you can use the template in any web app with just minimal changes to quickly build the web apps


It's solved. The problem was the file structure. For some reason the static files was in a core-folder. https://i.imgur.com/AnPACop.png

When i put the files directly in "static" it started working.

Model field reference | Django documentation, If the built-in fields don't do the trick, you can try django-localflavor (​documentation), which contains assorted pieces of code that are useful for particular countries  Writing your first Django app, part 6; Getting help FAQ Try the FAQ — it's got answers to many common questions. Index, Module Index, or Table of Contents Handy when looking for specific information. django-users mailing list Search for information in the archives of the django-users mailing list, or post a question. #django IRC channel


Multiple databases | Django documentation, If one of the methods is omitted, Django will skip that router when performing the relevant check. Hints¶. The hints received by the database router can be used to​  Django comes with its own lightweight development server. For a production environment, Django follows the WSGI spec, PEP 3333, which means it can run on a variety of web servers. See Deploying Django for more information. Django runs SQLite by default, which is included in Python installations.


Model instance reference | Django documentation, If you do so, however, take care not to change the calling signature as any change The from_db() method can be used to customize model instance creation  Django provides several views that you can use for handling login, logout, and password management. These make use of the stock auth forms but you can pass in your own forms as well. Django provides no default template for the authentication views. You should create your own templates for the views you want to use.


django-admin and manage.py | Django documentation, This document outlines all it can do. In addition, manage.py is automatically created in each Django project. It does the same thing as django-admin  Django uses Git for its source control. You can download Git, but it’s often easier to install with your operating system’s package manager. Django’s Git repository is hosted on GitHub, and it is recommended that you also work using GitHub. After installing Git, the first thing you should do is setup your name and email: