Static not working on unix while working on windows

198 views
Skip to first unread message

ashish goyal

unread,
Jul 6, 2020, 6:21:41 PM7/6/20
to django...@googlegroups.com
Hi All,

I have created a django app on windows and have used bootstrap navbar n other functions which are working good on windows.

Same files I have imported on unix server then i am able to get all details but getting issue with css and js files saying below error

Refused to apply style from <URL> because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled angular

I am using below script in windows which is working in windows but not on unix

{ % load static %}
<link rel="stylesheet" type="text/css" href="{ % static ‘main/css/bootstrap.min.css %}” />

Any suggestions, static and static url js defined i. Settings.py already. Since all working fine on windows dont know same code is not working for css and js while data is fetching correctly

Thanks
Ashish

Vishesh Mangla

unread,
Jul 6, 2020, 6:42:13 PM7/6/20
to django...@googlegroups.com

Href = “{% static appname/something.css %}”

 

Sent from Mail for Windows 10

--
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/D45C33B1-949B-4BBE-8338-8982F2A246BF%40gmail.com.

 

ashish goyal

unread,
Jul 7, 2020, 2:20:26 AM7/7/20
to django...@googlegroups.com
I am using same but still css is not available when i am clicking on css file link from inspect.

Is it because i have not configured nginx as i am just running app from runserver on unix machine.

Was working fine on windows. No change

Thanks
Ashish

On 07-Jul-2020, at 00:11, Vishesh Mangla <manglav...@gmail.com> wrote:



Exactly musty

unread,
Jul 7, 2020, 2:46:53 AM7/7/20
to Django users
Try this <link rel="stylesheet" type="text/css" href="{ % static ‘main/css/bootstrap.min.css' %}”>

Firstly you did not add the apostrophe to close the static tag, just try it this way,you can contact me if it does not work but am sure it will

ashish goyal

unread,
Jul 7, 2020, 4:08:43 PM7/7/20
to django...@googlegroups.com
Hey musty,

No those basic things are working already on windows. But not on linux. Once hosted css is not available, even after i did collectstatic in static folder but still css n js are not loading with static

> <link rel="stylesheet" type="text/css" href="{ % static ‘main/css/bootstrap.min.css' %}”>

Sent from my iPhone

> On 07-Jul-2020, at 08:17, Exactly musty <exactmu...@gmail.com> wrote:
>
> Try this <link rel="stylesheet" type="text/css" href="{ % static ‘main/css/bootstrap.min.css' %}”>
>
> Firstly you did not add the apostrophe to close the static tag, just try it this way,you can contact me if it does not work but am sure it will
>
> --
> 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/35233aa7-a4c2-4cbf-8d69-54ddc4844045o%40googlegroups.com.

Exactly musty

unread,
Jul 7, 2020, 4:27:56 PM7/7/20
to Django users
Oh,have you run migration yet,if you haven't, you need to sometimes while hosting

Kevin Jay

unread,
Jul 7, 2020, 4:55:54 PM7/7/20
to django...@googlegroups.com
I’ve had the same issue in the past. I fixed it by removing rel="stylesheet 


--
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.

Kevin Jay

unread,
Jul 7, 2020, 4:56:26 PM7/7/20
to django...@googlegroups.com
You also need to close your quote.

Avi shah

unread,
Jul 7, 2020, 7:24:49 PM7/7/20
to django...@googlegroups.com

Hi Ashish , 
I had the same error while deploying my django on iis windows server 
just copy paste the below code into your settings.py and you will have no issues
And i have done for js , you can do it for css too

import mimetypes

mimetypes.add_type("text/plain"".js"True)
mimetypes.add_type("text/javascript"".js"True)


And let me know if theres any error in django 

Thanks & Regards ,
Avi Shah

ashish goyal

unread,
Jul 8, 2020, 1:34:58 AM7/8/20
to django...@googlegroups.com
Ok avi (Import mimetypes) and kevin (Remove stylesheet - hope this works on redhat) will follow both changes and come back.

Since database is same When i was developing on windows and when i migrate to linux redhat then no migration needs to be apply when i did migrate.

Sent from my iPhone

On 08-Jul-2020, at 00:54, Avi shah <get...@gmail.com> wrote:


--
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.

ashish goyal

unread,
Jul 8, 2020, 5:03:26 AM7/8/20
to django...@googlegroups.com
Hi Avi, all,

I have all the changes but still No luck. Let me putup my configuration and error. Can anyone give suggestions 

Base.html


Settings.py

Static setting in setting.py

Inspect error

Server error:

Linux output with no css application


Expected and running on windows10 Dev




On 08-Jul-2020, at 07:03, ashish goyal <kumaras...@gmail.com> wrote:

Ok avi (Import mimetypes) and kevin (Remove stylesheet - hope this works on redhat) will follow both changes and come back.

Avi shah

unread,
Jul 8, 2020, 5:16:18 AM7/8/20
to django...@googlegroups.com
Hi Ashish ,

Could send me the image of your directory and why have you used the self ending tag while linking the css sheet , and I've attached my base.html file screenshot below and send me the snap of the whole directory 

And also send the picture of your console log of the page where the css is not loading 
image.png

Ajeet Kumar Gupt

unread,
Jul 8, 2020, 3:01:56 PM7/8/20
to django...@googlegroups.com
You tried to first run collectststic 

--
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.

ashish goyal

unread,
Jul 8, 2020, 4:25:48 PM7/8/20
to django...@googlegroups.com
Hi ajeet, yes done collectstatic

Sent from my iPhone

On 08-Jul-2020, at 20:31, Ajeet Kumar Gupt <ajeetg...@gmail.com> wrote:



Avi shah

unread,
Jul 8, 2020, 4:35:53 PM7/8/20
to django...@googlegroups.com
Hi Ashish , 
You saw what I sent ? 

ashish goyal

unread,
Jul 9, 2020, 5:09:55 AM7/9/20
to django...@googlegroups.com
Hi All, Avi, Ajeet,

As per suggestions received i have Removed the close tag of link and sending you directory structure And inspect error of my project hosted on linux rhel 7. No luck till now, though everything is working on windows.

Static is configured with Staticfiles folder And base.html lies in rdms/environment/templates/environment/base.html. I guess this is standardised and folder structure which is working on win10 but not on linux 


Win10


Linux hosted:


Thanks
Ashish


On 08-Jul-2020, at 10:45, Avi shah <get...@gmail.com> wrote:


Hi Ashish ,

Could send me the image of your directory and why have you used the self ending tag while linking the css sheet , and I've attached my base.html file screenshot below and send me the snap of the whole directory 

And also send the picture of your console log of the page where the css is not loading 
<image.png>


On Wed, Jul 8, 2020 at 10:33 AM ashish goyal <kumaras...@gmail.com> wrote:
Hi Avi, all,

I have all the changes but still No luck. Let me putup my configuration and error. Can anyone give suggestions 

Base.html
<image0.jpeg>


Settings.py
<image2.jpeg>

Static setting in setting.py
<image3.jpeg>

Inspect error
<image4.jpeg>

Server error:
<image5.jpeg>

Linux output with no css application
<image8.jpeg>


Expected and running on windows10 Dev
<image6.jpeg>

Reply all
Reply to author
Forward
0 new messages