0

I have recently begun making a Django project on PythonAnyhwere.

I have followed the entire tutorial provided by Django for including static files on the project. I have observed the programs work fine on a site with http, but does not work on a site with https.

What could be the reasons and how can I overcome this problem?

Edit : The site is working now, apparently, but I would still like an explanation as to why it WAS working differently, if anyone can provide. Site on Https Site on http

2
  • The url of your https link is incorrect. iparvez.pythonanyhwere.com/blog/home you have spelled where as hwere. I tried this iparvez.pythonanywhere.com/blog/home and it worked well for me Commented Oct 3, 2021 at 4:56
  • @ShreyasPrakash Oh yes, it's working now apparently, but I still do not know why this error happened in the first place. I'll edit the question accorfingly, thanks! Commented Oct 3, 2021 at 4:59

1 Answer 1

2

to load your CSS files (or totally static files), you need to follow the steps below:

1- inside settings.py

STATIC_URL = '/static/'

STATIC_ROOT=os.path.join(BASE_DIR,'static')

MEDIA_ROOT=os.path.join(BASE_DIR,'media')

MEDIA_URL='/media/'

2-collect static files using bash console

python manage.py collectstatic

3-you need to enter the Static files directory inside the web tab

check the image below

static files python anywhere

4- reload your web app

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

Comments

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.