CSS 404 error using Django - css

CSS link:
<link rel="stylesheet" href="/site_media/style.css"
type="/text/css" />
I'm getting a -404 error while loading my CSS sheet.When I try to debug the location thru Firebug(Firefox), I get the below location.
"C:\Python27\Djangoprojects\django_bookmarks..\django_bookmarks\site_media\style.css" does not exist
Site_media is determined by the Python code in URLS.py
site_media = os.path.join(os.path.dirname(__file__), 'site_media')
Why do I get the ..\ in the location?

Related

Laravel URL issue

In my source code of Blade file of CSS include URL is like below
<link rel="stylesheet" href="{{ asset('frontend/css/bootstrap.min.css') }}" type="text/css">
But I am getting below URL in page source of browser
<link rel="stylesheet" href="http://127.0.0.1:8000/public/frontend/css/bootstrap.min.css" type="text/css">
Why I am getting this ? How can I remove public from the URL ?
You're getting public in the path because you're accessing your site the same way http://127.0.0.1:8000/public/.
You need to change how your server serves the application.
asset() function points to the public folder. For your css file to work make a 'frontend' folder in the public directory

Assetic on Symfony won't work in production Symfony

I uploaded my SF Application from my local (machine) to production (Cpanel server)
everything looks fine on production except the css, js, etc. (All files inside the web directory.
I open the var/logs/prod.log just to check whats happening and I find out these errors.
request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /stylesheets/base.css" (from "http://example.com/admin/login")" etc.........
Now, what I did is to open the base.html.twig and made changes on the path of css/js files.
From
<link href="{{ asset('stylesheets/base.css') }}" rel="stylesheet" />
To the full directory.
<link href="{{ asset('/home2/swipecom/public_html/web/stylesheets/base.css') }}" rel="stylesheet" />
By the way, here's the directory of the application in the server.
home/swipecom
cache
contactless (Where SF directories live)
- public_html (/web the only SF directory)
var
ssl
tmp
public_ftp
logs
I made it work using this code
<link href="{{ asset('web/stylesheets/base.css') }}" rel="stylesheet" />

Issue loading CSS and JavaScript files in Laravel

I'm having a strange issue in my Laravel 5.2 app. Specifically with loading some CSS and JavaScript files. I have this in the folder public/assets so, I have something like this:
|--public
|----/assets
|-------/css
|------------/auth
|---------------login.css
|----------main.css
|-------/js
|---------email.js
|---------/modules
|------------faq.js
That is my directory, so I'm loading the CSS with:
<link href="{{ URL::asset('assets/css/main.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/css/auth/login.css') }}" rel="stylesheet" type="text/css" />
And the JavaScript files with:
<script src="{{ asset('assets/js/email.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/js/modules/faq.js') }}" type="text/javascript"></script>
Also I'm loading another files as well but I'm explaining the basic situation. So, the thing is that the load of login.css and faq.js are giving me 404 error but the other files are loaded correctly, I even checked open the files through the absolute paths and they're loaded fine, also I made chown to www-data of the public folder but nothing works, so I don't know why a 404 error is triggered. What else should I check?
In the console of the browser the links that are loaded are:
http://mydomain/assets/js/modules/faq.js
http://mydomain/assets/css/auth/login.css
But they give 404 error, and the other files doesn't
first check those 404 files are in there definitely
check those files have readable permisstion

Styling Jekyll website with Bootstrap

I am trying to set up a website using Jekyll and GitHub Pages (first-timer), and most importantly, to style it with Bootstrap.
You can check what I have already done:
GitHub repository: https://github.com/thibaudclement/wallaby
GitHub page: http://thibaudclement.github.io/wallaby/ (check gh-pages branch)
Also, I followed this tutorial to import Bootstrap into the Jekyll structure.
Layouts and includes seem to work just fine, but I don't understand why my index.html does not get "styled" as it should, fetching information into the css/style.css file.
Any idea of what I am doing wrong?
Thanks.
The path to your css file is incorrect - it's not loading if you check your browser console
"Failed to load resource: the server responded with a status of 404 (Not Found) - http://thibaudclement.github.io/wallaby/style/site.css"
In _config.yml, you need to set baseurl: /wallaby.
And use {{ site.baseurl }} to load resources like this :
<link href="{{ site.baseurl }}/css/style.css" media="screen" rel="stylesheet" type="text/css" />.
See Jekyll documentation.

404 error while attaching css file though file path is correct.

my css file exists in my localhost as follow :
C:\xampp\htdocs\wordpress\wp-content\themes\eghotok\jquery_ui\test.css
I wrote code to add css file as follows:
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/query_ui/test.css">
But I got 404 error for this file.
Even I checked this error by developer tool. it says :
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/wordpress/wp-content/themes/eghotok/query_ui/test.css
I checked again and again the physical location of css file and location in my code. What am I doing wrong. Please help.
In the link-tag the "j" on "jquery" is missing:
http://localhost/wordpress/wp-content/themes/eghotok/query_ui/test.css

Resources