Admin site's css doesn't work.

80 views
Skip to first unread message

English Learning

unread,
Sep 17, 2020, 9:47:27 AM9/17/20
to Django users
when I host it, Admin's CSS doesn't show. Also, I am using SQLite database. Screenshot is here: 

DjangoAdmin.png
Is it a Database problem? Please let me know the answer. I am suffering from it because it is a Client project.  

Omkar Parab

unread,
Sep 17, 2020, 10:12:01 AM9/17/20
to django...@googlegroups.com
server is not able to find your static files. Run collect static command and add static root to your settings.py 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3832905f-33cf-484f-bc01-8ee78dbc487dn%40googlegroups.com.

Ankit Gadewal

unread,
Sep 17, 2020, 11:09:01 AM9/17/20
to django...@googlegroups.com
If you run it on localhost it works fine but when you run site in production static files fails to work. So you have to add static root in Django setting.py file like STATIC_ROOT = os.path.join(BASE_DIR, 'static') and then run python manage.py collectstatic command. It will collect all the server site static files in a folder in base directory named static. And then you have to register static files on the server(for example Apache) depends on server type. After this configuration admin CSS will work. I had the same problem with my project. And the problem solved after I am doing the same as I mentioned above.... If any problem arises please let me know.

--

English Learning

unread,
Sep 19, 2020, 1:13:18 AM9/19/20
to django...@googlegroups.com
Thank you so much for your Amazing, Lovely Answer. I added static  STATIC_ROOT = os.path.join(BASE_DIR, 'static') . But the problem is I didn't register static files on the server. Please can you tell me? how can I register for it? I am using Linux shared hosting with Cpanel. Is there any tutorial or blog to get rid of it? Love From heart
Regards,
Mainul 

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/u3JU2XAXz58/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALha6NvqSxYcoALqrON8BQp0O3e%3DKFuLtJKXRBE_fxsXdVCs1Q%40mail.gmail.com.

Ogunsanya Opeyemi

unread,
Sep 19, 2020, 5:02:04 AM9/19/20
to django...@googlegroups.com
Try creating a project locally on your computer set STATIC_ROOT in the settings fileand run this command python manage.py collectstatic then go to the static root folder and copy the static files the put it insIde the static root folder on the cpanel. 


On Saturday, September 19, 2020, English Learning <mainulis...@gmail.com> wrote:
Thank you so much for your Amazing, Lovely Answer. I added static  STATIC_ROOT = os.path.join(BASE_DIR, 'static') . But the problem is I didn't register static files on the server. Please can you tell me? how can I register for it? I am using Linux shared hosting with Cpanel. Is there any tutorial or blog to get rid of it? Love From heart
Regards,
Mainul 

On Thu, Sep 17, 2020 at 9:09 PM Ankit Gadewal <ankitga...@gmail.com> wrote:
If you run it on localhost it works fine but when you run site in production static files fails to work. So you have to add static root in Django setting.py file like STATIC_ROOT = os.path.join(BASE_DIR, 'static') and then run python manage.py collectstatic command. It will collect all the server site static files in a folder in base directory named static. And then you have to register static files on the server(for example Apache) depends on server type. After this configuration admin CSS will work. I had the same problem with my project. And the problem solved after I am doing the same as I mentioned above.... If any problem arises please let me know.

On Thu, Sep 17, 2020, 19:16 English Learning <mainulis...@gmail.com> wrote:
when I host it, Admin's CSS doesn't show. Also, I am using SQLite database. Screenshot is here: 

DjangoAdmin.png
Is it a Database problem? Please let me know the answer. I am suffering from it because it is a Client project.  

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/u3JU2XAXz58/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADR4xT-njgOcMJWEr%2BDTbrsB8GJdR3k%3DR7CZ2WwFwiYGwykmzQ%40mail.gmail.com.


--
OGUNSANYA OPEYEMI

Reply all
Reply to author
Forward
0 new messages