Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Admin CSS files are missing

I deployed my django app to pythonanywhere.com and my admin css not working http://directdirect.pythonanywhere.com/admin/login/?next=/admin/ what do I do? I use django 2.0 settings.py:

 Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'django_direct/main_app/static'),
    os.path.join(BASE_DIR, 'django_direct/main_app/static'),
    http://directdirect.pythonanywhere.com/static/admin/css/dashboard.css
]
like image 461
user2950593 Avatar asked Apr 20 '18 20:04

user2950593


Video Answer


2 Answers

Check your settings.py file.

DEBUG = True    # debug true mod working admin css
DEBUG = False   # debug false mod not working css

You can fix it using a proxy server or by running Django with the insecure parameter.

  • Use NGINX Proxy Server: django-with-nginx
  • Use Insecure Parameter: run-django-with-insecure-argument
like image 68
waruna k Avatar answered Sep 27 '22 23:09

waruna k


I assume you followed similar instructions to this page from help.pythonanywhere.com.

There it says:

Go visit your site, it should be live! But it probably won't be using your CSS stylesheets, JavaScript and other things that are loaded from static files. To get those set up, check out the page configuring static files with Django.

And here is the link to get those static files up and running.

This should point you in the right direction.

like image 42
Ralf Avatar answered Sep 27 '22 22:09

Ralf