New-ish coder and first time stack overflow poster. I've made a django project with 3 pages. Sometimes no pages are found , sometimes the index page loads without 404 error but I can't link to other pages and the css files I've pointed it to doesn't render .
Errors I'm getting is:
I have slept on the problem, looked up file formats to make sure my project and app url.py is correct. added app to settings. imported correct classes. I have also tried clearing my browser data on chrome and using a different browser.
If anyone could take a look at my small project on github that would be amazing. https://github.com/Connell-L/portfolio_website is the link or if anyone wants me to post code files on codepen or something I'm more than happy to do it.
Edit: https://github.com/Connell-L/portfolio_website/tree/branch1 it's here sorry lol
You need to add STATICFILES_DIRS and STATIC_ROOT to your project settings.py
like this:
BASE_DIR = Path(__file__).resolve().parent.
the above line of code has to be at the bigining of your settings.py file
STATIC_URL = "static/"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static")
]
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.