Please Can Some one Help me To get my static files load my default CSS files

36 views
Skip to first unread message

Timothy Steele

unread,
Aug 7, 2016, 8:16:57 PM8/7/16
to Django users
Please any time i try to load my Django admin panel the default CSS files does not load and even i have to refresh several time before i can  the css file will load, and even if i log in still the interface become different, it does not load the CSS files. I believe this is coming form the static files which i have not loaded but i did what ever i could and it did not work for me so i need  a help please.
Please below is an attach file of screen shots i took 

Any way i am still a beginner

THANKS
Please this is the log in screen short.docx

M Hashmi

unread,
Aug 7, 2016, 10:34:03 PM8/7/16
to Django users
In your settings.py how did you setup your STATIC_URL and STATIC_FILEDIRS?
Copy paste your settings.py code below STATIC_URL with your DB engine settings. DB looks working fine because your page is showing up so we can use same BASE_DIR conventions for setting up your static.

Timothy Steele

unread,
Aug 8, 2016, 4:54:40 AM8/8/16
to Django users

Timothy Steele

unread,
Aug 8, 2016, 4:58:46 AM8/8/16
to Django users


On Monday, August 8, 2016 at 1:16:57 AM UTC+1, Timothy Steele wrote:
(any way this is the best group i have join so far thanks to all of you)

PLEASE MY FRIENDS I BEG 
can you give me a step by step process to do this 
thanks very mach

 

M Hashmi

unread,
Aug 8, 2016, 6:49:41 AM8/8/16
to django...@googlegroups.com
You need to set your static in settings.py and I am giving you simplest idea you can implement with no issues.

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static', 'static-only')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'media')
STATICFILES_DIRS = [
       os.path.join(BASE_DIR, 'static', 'static'),
]

Now in your project source folder create a new folder named 'static' which will refer to values in blue.
In your 'static' in blue folder create subfolders with names 'media', static-only', 'templates' and 'static' again. So hierarchy should look like this:

static
----static
----media
----static-only
----templates

In your settings.py in "TEMPLATE" section find simalr line like below and change it as I did.

'DIRS': [os.path.join(BASE_DIR, 'static', 'templates')],

Now go to your terminal (command shell) and run following command.
./manage.py collectstatic

It will ask you are you sure you want to do this. Type "yes" and press enter.

.manage.py runserver and refresh your page.

You will get all the css loaded.

Furthermore you can create three new folders in your /static/static/. 

static
----static
             |
             -------css
             |
             -------js
             |
             -------images  
----media
----static-only
----templates

In your static/static folder you can keep the project template related css/js/images. All your html based code will go to /static/templates folder. Read the link below thorough and in case of issues you can post another question or to same thread.


Regards,
Mudassar

--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7f5ae2e5-11f7-429b-b4a3-78a8d36ef787%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Timothy Steele

unread,
Aug 8, 2016, 8:27:18 AM8/8/16
to django...@googlegroups.com
M Hashmi
Thanks
For the response it work for me.
I will like you to also give me a step by step process on how to add a template downloaded 
so that i can change the default template  

--
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/hiSv5Nf2z5M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

M Hashmi

unread,
Aug 9, 2016, 2:52:13 AM8/9/16
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages