CSS code not being applied to my flask application - css

I am learning how to build flask applications. But, whenever I write some CSS code, and link that to my html template, the css never gets applied. No matter what I do.
Here is the line that links my html template to my css file:
<link rel="stylesheet" href="{{ url_for('static',filename='css/base.css') }}">
Here is what I did:
I tried restarting my server.
I searched for this online. This is what I found: CSS not being applied in Flask app. However, even that did not help.
I believe my server does not find my css file, because this is the entire output in my terminal:
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 222-949-106
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [11/Nov/2020 21:18:46] "GET /login HTTP/1.1" 200 -
127.0.0.1 - - [11/Nov/2020 21:18:47] "GET /login HTTP/1.1" 200 -
As you can see, my css file is not mentioned anywhere. Where is the mistake?
Please help me.

I hope this is because of the cache. The browser will load CSS once from the server and then it will be stored in the cache memory.
You do remove the cache memory by Shift + F5.
Note: If you may think that the server does not find your CSS file, but if it can't able to find the file, you may encounter with 404 error. In your case, you didn't get that error. So the only possible answer is CACHE.

Related

Using uninitialized "redirecttoindex" variable

Suddenly out of nowhere I can not log in into my WordPress site. The site is working but wp-admin is not. In the error log I get:
2022/07/04 23:45:58 [warn] 31793#31793: *300658 using uninitialized "redirecttoindex" variable, client: ip.000.000.000, server: mydomain.com, request: "GET /wp-admin/HTTP/2.0", host: "mydomain.com"
How can I debug this? I have just got this site for maintenance and I am not very familiar with WordPress. Should I diff it with the original version and see if files are modified?
I scanned the code and there are no redirecttoindex variables. Is something up with nginx?
I also can not find anything on google with such a query.
Server API: FPM/FastCGI
PHP Version 7.4.26
nginx/1.20.2
You confirm the other pages in the sites this working well ? If the answer is Yes, you need the check if exists some plugin what redirect the route of wp-admin for new route. First we have to activate the debug mode in the wordpress in the file wp_config find de const WP_DEBUG and set true.
P.S: Don´t activate the DEBUG in the product view.

Error KnpSnappyBundle / wkhtml - ConnectionRefusedError

I have an incomprehensible problem.
I have used this bundle many times, and I understand the main logic to generate a pdf from a twig view.
But on my two last project i have this kind of error:
Error: Failed to load https://mydomain/bundles/bundle/css/bootstrap.css, with network status code 1 and http status code 0 - Connection refused
Exit with code 1 due to network error: ConnectionRefusedError
I have tried:
HTTP and HTTPS url
chmod 777 on var/cache folder - try acl
disable all parameters of wkhtml
update wkhtml
Disable extends twig view - ihave made a new file with full HTML
Clean controller use assets
filter / absolute_url filter / or web_url variable to prefix assets
On my development environment (Windows), i didn't have any problem.
This problem appeared when I work on production environment, based on Debian 9 with nginx, php 5.6, mariadb 10.0* and letsencrypt certificate.
I can't load any assets for now.
Does anyone have an idea??
Ok i have found a workaround. I use this trick :
create a global variable with this path :
pdf_url: '%kernel.root_dir%/../web'
then i call my assets like this :
<link href="{{ pdf_url}}/bundles/css/bootstrap.css" rel="stylesheet">
Its a not the ebst solution, but its works.

Unable to render CSS in MAMP localhost

I am experiencing something very strange when implementing the Metronic Admin panel into a new Laravel project. I have broken everything up into partial blade files, and included all CSS and JS using the standard
{{ asset('...') }}
blade syntax. The problem I am facing is the loading of a single CSS file, in that all browsers will hit this point and stop. What is even weirder is that there are no console errors and no output in the performance tab in Chrome, everything just hangs.
The CSS file in question is
<link href="{{ asset('admin/demo/demo3/base/style.bundle.css') }}" rel="stylesheet" type="text/css" />
Unminified, this CSS file is 55,000 lines long so I'm not too sure if this is something to do with just the sheer size of the file, however, leaving Chrome for 15 minutes has not produced any results at all.
I am able to open the static HTML file from the download folder, which links to this same file and renders perfectly fine, using the file:// method, but when these files are added into the localhost path, the same problem happens again. This leads me to believe this is not a problem with Laravel, but a problem with the localhost instance instead.
The localhost is running the latest version of MAMP on Windows 10, not had any other problems with any other sites, just this single CSS file.
I can also see in the Apache access.log file that these assets are being found with a 200 status code
127.0.0.1 - - [29/May/2018:21:05:41 +0100] "GET /digitaltools/public/home HTTP/1.1" 200 623
127.0.0.1 - - [29/May/2018:21:05:41 +0100] "GET /digitaltools/public/admin/vendors/base/vendors.bundle.css HTTP/1.1" 200 357894
127.0.0.1 - - [29/May/2018:21:05:41 +0100] "GET /digitaltools/public/admin/demo/demo3/base/style.bundle.css HTTP/1.1" 200 1736133
Any help would be greatly appreciated.
After a clean install of MAMP this seems to have solved the problem. Very strange behaviour.

PERIODICALLY Error: zend_mm_heap corrupted

Description: PERIODICALLY when adding a file through the API, the server crashes with the error in /var/log/httpd/error_log: zend_mm_heap corrupted.
This happens sometimes, then itself begins to work normally. Ie file is normally loaded, then it ceases to be loaded. Although at this time the other can be loaded normally.
I use API /api/providers/sonata.media.provider.file/media
The provider of the file system: sonata.media.filesystem.ftp
Development environment: no matter dev / prod
Composer:
sonata-project/media-bundle: "2.3.x-dev"
knplabs/gaufrette: >=0.1.4
apache+mod_php:
httpd-2.2.15-47.el6.centos.x86_64
httpd-itk-2.2.22-7.el6.x86_64
php55w-5.5.30-2.w6.x86_64
Other:
zend.enable_gc = Off
opcache.fast_shutdown = Off
USE_ZEND_ALLOC = 0
Issue: https://github.com/sonata-project/SonataMediaBundle/issues/866
Same issues with similar Symfony 3 with media bundle setup.
php_flag opcache.enable Off
Disabling opcache in .htaccess / php.ini solved the problem.

Symfony2.5.0 fresh install - No route found for "GET /", 404 Not Found - NotFoundHttpException

Hi I am new to symforny2
I have just installed symfony2 on my easyphp server. When I open web directory symfony try to open app.php. For some reason I got this output:
No route found for "GET /"
404 Not Found - NotFoundHttpException
1 linked Exception: ResourceNotFoundException »
[2/2] NotFoundHttpException: No route found for "GET /" +
[1/2] ResourceNotFoundException: +
Logs -
Stack Trace (Plain Text) +
When I open app_dev.php, everything looks normal.
Why do I get this 404 error on app.php ? Is that normal or is this a bug in symfony2.5.0
(demos in app_dev.php are working well)
Thank You for your support.
Regards
See one of my previous answer: symfony2 - how to switch from "dev" to "prod"?
Symfony wraps multiple environment. When you access the app.php front controller, you're on the prod environment whereas when you access app_dev.php, you're on the dev environment.
Knowing that, the demo bundle shipped with the standard edition is only enable on the dev environment according to the AppKernel. So, it is normal you can access the demo page on the dev front controller and get a 404 on the prod front controller.

Resources