cppcms: 404 error for css and js files - cppcms

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.

Related

Website 404 error when I move files to root directory

My all files exist in subdirectory jbsafi.com/rahmatkhancopy in file manager. I want to move all the files to root directory but it displays 404 error when I do so. What is wrong with my file? May be something wrong with my .htaccess file but I don't know how to resolve it. The .htaccess file is blank now.

Wagtail new installation : CSS not working

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

Wordpress Apache2 mod_speling not working

I am in the process of migrating my site to Wordpress from IIS.
I have run into an issue:
I have URL's that are a mix of upper and lower case that reference images. These URL's are getting a 404 because the case of the URL does not match the case of the file location.
For example, in my article I have a URL:
https://aaa.bbb.com/wp-content/migrate/ABC/abc.png
The file this is referencing is: /var/www/aaa/wp-content/migrate/abc/abc.png
When I change the URL to the same case as the file, it works, however how can I make it ignore the case of the folder on disk?
I tired the mod_speling module by putting this into /etc/apache2/apache2.conf but this just does not work for me. Also tried putting this into .htaccess in the root of my web directory but that made no difference.
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule>
I have read various threads on here but I'm completely stuck.
I managed to find a work around to this.
I ended up writing a rewrite rule in the VirtualHost file to rewrite everything to lowercase apart from anything within the directory of assets imported from Windows.

Why is Scout trying to alter files in non-specified directory?

I've used Scout before but haven't run into this problem... when I save a change to an scss file (the scss directory is specified as the "input" folder) which should then rewrite my styles.css file (in the specified "output" folder), I am given an error from scout stating "Error on line 61 of c: File not found or cannot be read:", and it then point to an image file in a separate folder within the site I'm working on.
Why could this be happening? I tried create two Scout projects for the same site: One where the root folder of the site is selected as the main directory and one where the folder a few levels into the site containing the scss and css files are held, but got the same results from both. I don't know why scout would be going into an image folder when the input/output folder are explicitly selected.
How can I make it so Scout just detects changes to my scss files and rewrites the css file without any nonsense about image files? Any help would be appreciated.
Edit: I hope this can give some insight, but the file that seems to be causing the error is being described in a location it is not in: C:\Users\me\Desktop\project/logo.png
There is a logo.png file in another location (C:\Users\me\Desktop\project\apply\assets\img\logo.png) but that doesn't seem to account for the error message. Very puzzled.
Second Edit: I'll try to give this one last bump with a little more info. At this point when I save a scss file I am still getting the same long error message in the scout app about an error, but my style.css file has stopped being affected at all since yesterday. The last message I got was a syntax error and then a very long backtrace message that looks something like this...
Backtrace:
C:/Users/me/Desktop/project/apply/assets/scss/_base.scss:6
C:/Users/me/Desktop/project/apply/assets/scss/style.scss:12
c:/program files (x86)/scout/vendor/gems/gems/sass- 3.2.1/lib/sass/../sass/script/variable.rb:49:in `_perform'
c:/program files (x86)/scout/vendor/gems/gems/sass-3.2.1/lib/sass/../sass/script/node.rb:40:in `perform'
c:/program files (x86)/scout/vendor/gems/gems/sass-3.2.1/lib/sass/../sass/tree/visitors/perform.rb:294:in `visit_prop'
org/jruby/RubyKernel.java:2096:in `send'

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