Wagtail new installation : CSS not working - css

I tried the official installation guide for installing wagtail locally :
first by creating a website
second by integrating wagtail into a new website
Each time it seemed to work fine functionally but all the CSS was broken (see pic down)
I tried to do "manage.py collectstatic", it told me that 2/3 hundred files have been copied, I emptied the cache of my browser, loaded the page again, no change.
In the console it seems that the files are sent :
[14/Jul/2019 10:16:54] "GET /static/css/welcome_page.css HTTP/1.1" 200 3003
I restarted several times the tutorials from the beginning making sure I do each step exactly as described, nothing changes. When I begin with a new django project, the base django css is working before I add wagtail. I m using Python 3.6.8, Django 2.2.3 and Wagtail 2.5.1. What am I doing wrong ?
To answer #Dan Swain comment :
Settings.py file :
https://pastebin.com/zZqDesnr

Ok so simply my django-wagtail server was serving css but with an incorrect mimetype. My browser received the css but because of the wrong mimetype it didn t apply them
I had to add :
import mimetypes
mimetypes.init()
mimetypes.types_map['.css'] = 'text/css'
To my settings files and everything worked fine

One standard Wagtail folder structure includes a settings folder (not just a settings.py file). Inside the settings folder you would find base.py, dev.py, local.py, and production.py. You are using, instead, a plain settings.py file that is at the same level in the directory structure as your wsgi.py. Inside your settings.py you have a BASE_DIR declaration that is typically used in the settings folder setup:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
I think that your problem will be fixed if you change that line to:
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

I found missing 3 style files by F12 debugging. Copy the style folder to the target folder. From wagtail-master\wagtail\admin\static_src\wagtailadmin\scss to wagtail-master\wagtail\admin\static\wagtailadmin\css. That solve my style error.

if CSS is not working in admin panel in wagtail. you should check your nginx setup at first. in nginx there are should be such configurations:
location /static/ {
alias /home/path_to_project/project/staticfiles/;
}
please give attention, there should be alias not root

Related

How to solve - .css was blocked due to MIME type when building tailwind

I was building my tailwind css project with - npm run build. But then when I open builded index.html , css file wasn't loading.
This is showing .How can I fix this!
I dont know what to do
Check if the file path is correct and the file exists, in NodeJS you need to specify a path for static files.

cppcms: 404 error for css and js files

I am using cppcms ver 1.2, and want to include external css and js files as follows:
media/css/bootstrap.min.css
But I get a 404 error for them, even though the files exist in the media folder in my root folder of the app.
I tried copying the media folder manually to the CMakeFiles folder. But that didnt work also.
Still keep getting a 404 error for localhost:8080/media/style.css or any of the other css or js files.
What is the document root of the cppcms, and if it is the root folder where the code is, then why isnt it able to read them?
My code is modelled on the examples/message_board sample.
The problem was beig caused by the redirect in the config file which was redirecting everything to the root url. Added exclusion there for the media folder, and the message_board sample and my code worked.

Django CMS - Template Does Not Exist Error while creating first page

I followed the instructions for installing Django CMS on my mac. When I run "manage.py cms check", everything is fine, except it says it cannot find the template_1.html. When I go into the admin to create a page, the template is in the Template drop down. When I try to save the page it gives me "TemplateDoesNotExist at /admin/cms/page/add/".
Maybe it's noteworthy, I was having issues with the url prior to this error. I was not able to open the admin or even get main page to render in the browser. After searching stack overflow I found the same issue. I changed the url patterns from the "urlpatterns = i18n_patterns" to the standard. That worked. Now I have this issue. Any assistance would be appreciated. Thanks.
Link to Traceback if needed:
http://dpaste.com/hold/1430437/
I had the same error (on Ubuntu 12.04)
Following the django-cms 2.4.3 installation instruction,
django-admin.py startproject myproject
creates a directory myproject (in which manage.py resides) and a subdirectory, also named myproject, which contains the setting files and the templates directory.
I don't know if this is the intention of the authors of the django-cms doc. But the instruction
os.path.join(PROJECT_PATH, "templates"),
in the TEMPLATE_DIRS setting points to /absolute/path/to/myproject/templates.
This should be changed to:
os.path.join(PROJECT_PATH, "myproject/templates"),
to point to the correct directory /absolute/path/to/myproject/myproject/templates

Drupal Site Download : Not able to install site as-is

I recently downloaded a fully functional drupal(6) site using FTP. Though I installed the Drupal instance, I got the modules and the themes that were in the sites/all folder, but wasn't able to get the actual site configuration ( Configuration and Settings of those modules )
Any help in this regard would be greatly appreciated.
Assuming this is a follow-on of: Drupal Site install on localhost after downloading source using FTP
If you get the Drupal install screen when accessing a site you've just migrated to your localhost, it's likely because you're trying to access the site locally using a URI that's different than the remote site AND this URL does not fall within the directories that Drupal searches when looking for a settings.php file (see comments starting about line 20 in the default.settings.php file of the sites/default folder).
You have two options:
Option 1: Create a symbolic link on your localhost that points requests to your local URI to the directory hosting the live site. This would look something like this:
ln -s /path/to/webroot/sites/default/ /path/to/webroot/sites/mydevsite.dev
Option 2: Create a sites/sites.php file that maps URI's to the correct folder hosting your settings.php file. For example, you'd add this to sites/sites.php if you left your settings.php file in the sites/default folder:
$sites['mysite.dev'] = 'default';
$sites['www.mysite.dev'] = 'default';
$sites['mysite.com'] = 'default';
$sites['www.mysite.com'] = 'default';
Simply put, this translates into: "Serve sites mysite.dev, www.mysite.dev, mysite.com, and www.mysite.com from the folder located at sites/default."
I usually use the second option. It's more sustainable, OS independent, and can be committed to source control.
Update based first 5 comments:
You need to edit the .htaccess file in your Drupal install. Look for this section:
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
And do as it says, uncomment out the line and set it to your subdirectory.
Yes the steps are correct. Is it the design that is not coming or is the functionality of views missing? If its only the css that is not coming, then the issue could be that your theme is not getting applied. Check if the theme folder correctly exists, and disable/enable the theme.

Images in FTP but URL says page not found

So I have been reading all i can for the last 2 hours and have not a solution.
I moved my drupal site from one host to another, all works well minus:
images in the the 'sites/defualt/files' folder are in the FTP and i can priview them there but when got to the URL I just a page not found message.
example image URL: http://www.example.com/sites/default/files/image.jpg
this what's in my code and the path is correct but the image does not show.
Here's what I have checked:
Clean url's are enabled,
'admin/settings/file-system', set to public
'admin/settings/file-system', File system path: 'sites/default/files' as it should be
.htaccess in files folder is set to
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
# Options None
# Options +FollowSymLinks
and I have tried it with '#' removed
I have tried leaving the settings.php $base_url ="" blank and with my exsample domain
I have the files folder set to cmod '777'
Checked the database files table, path is set to 'sites/default/files/imagename.png', which seems right
image names do not have spaces in them.
I have been flushing the cache for the testing different settings
I have run the cron as well.
I don't know what I am missing the files are there, the paths are even correct when i look at the rendered html, but the images are just not showing and the direct urls say 'page not found'
Any Help would be awesome, I thought i had this problem before and solved it but i have no idea I missed.
Thanks for any help
Hhmm, have you checked that all parent folders have at least the execute flag set so that you can browse into them? I think it is safe to set all folders as: 755
Another way to debug this is trying to download other files contained in other folders, e.g. the README in root or some files in the misc/ and modules/ folders.
Just deleted .htaccess file inside default/files it solved the issue for me..I dont exact lines of code need to be there in .htacces file..

Resources