I have a django instance set up on pythonanywhere.
I have debug turned off in my settings
I have a STATIC_ROOT setting of os.path.join(BASE_DIR, "allstatic").
I have set up the static files mapping in the Web section of my pythonanywhere console
URL = /allstatic/
Directory = /home/username/project/allstatic
(I'm calling it allstatic so I can tell that the files are coming from the mapping)
I have run collectstatic and /allstatic has files in it.
I am using {% static 'folder/file' %} in my templates
And with all this - the static files were all being delivered. However, when I checked the page source HTML, they all appeared to be coming from '/static' So I wasn't sure if they were being delivered by the more efficient console driven mapping.
When I changed 'STATIC_URL' setting to 'allstatic' the html shows '/allstatic' and the files still load. BUt I'm not sure how to tell if my mapping is working.
To use a concrete example
I have an app called 'universal' in django, with the following structure
universal
static
universal
img
logo.png
In my local dev environment, with debugging on, this shows up as /static/universal/img/logo.png
However, in my prod environment with debugging off and all the above steps taken, this also shows up as /static/universal/img/logo.png - until I set the STATIC_URL to allstatic
How can I be sure I am using the allstatic mapping I set in the pythonanywhere console? And does STATIC_URL affect whether I am using it or not?
I figured it out.
In order to test that the web console static mapping is working on pythonanywhere, I made the following setting explicit and then commented out AppDirectoriesFinder
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
#'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
This ensures that app directories aren't being looked at to find static files - it will require the Web Console page mapping (or an entry in STATICFILES_DIRS which is empty by default) to be set up correctly to find files.
Doing this I was able to find that my previous STATIC_URL setting of 'static/' rather than 'allstatic/' had in fact been failing to use the mapping - something previously obscured by the fact that both /static/universal/img/logo.png and /allstatic/universal/img/logo.png seemed to work.
(It's interesting that the app level /static locations still work on pythonanywhere with debug turned off - I suspect this fact was muddling me a bit).
Related
Let's say I have some website with the name website.eu. When I deploy it and try to get access to a page online like this website.eu/about I catch the error:
"404 The page you're looking for could not be found. The resource that you are attempting to access does not exist or you don't have the necessary permissions to view it"
When I click on the link that brings me a website.eu/about it works well, but trying to type that URL in the input field it fails.
Everything works fine locally.
The project is developed using Vue3.
The project is no GitLab.
If someone helps I would appreciate it.
Hard to tell without seeing the code, but my guess is your router setup uses the web history mode, which relies on the server to have certain settings applied.
I believe switching to hash mode (while adding # to the routes) will work.
Alternatively, you can update your server to support redirects to have the html mode work.
example server configurations
On my live site 'mysite.com' I see the following error message in the console:
Blocked loading mixed active content “dev.mysite.com/fileadmin/templates/fonts/glyphicons-halflings-regular.woff2”
[Learn More]
jquery-1.11.3.min.js:4:24860
Blocked loading mixed active content “dev.mysite.com/fileadmin/templates/fonts/fontawesome-webfont.woff2?v=4.7.0”
[Learn More]
jquery-1.11.3.min.js:4:24860
I have no clue how it got there and don't remember what I changed. Where do I need to look for and how can I fix this?
I do have a Development Site ... dev.mysite.com ... and for deployment I just move the new files into the live folder.
Edit: I want to fix this problem by loading the files from my live site ... but I don't know from where I'm loading those files.
As those font-files are probably loaded from CSS I assume you already load your CSS from the dev server.
Check this out in the your browser (Network-tab).
You might see it in the HTML source. But the loading also could be initiated by javascript. so you need to check that too for any references to your dev-server.
Then you need to identify the source of this inclusion. If it's in the javascript it's obvious.
The CSS includes can be initiated in multiple places. The most common are in typoscript, so first try: go to the Template Analyzer and look for your dev-server domain. Identify the template and modify it.
Following the steps mentioned at mybatis-ignite integration page # mybatis-ignite with Ignite 2.0, i see that the call to the mapper hangs & never returns. This is after working around several other issues like requiring ignite-cache configuration to be placed in IGNITE_HOME/config/default-config.xml which still doesn't get picked up unless i place it in a physical location in the project dir (otherwise i see the error in the log "Initializing the default cache. Consider properly configuring 'config/default-config.xml' instead.") which again also seems to have no effect.
Since the integration seems to have several issues i am not sure if it is still supported..any thoughts from any one who has successfully done this or from the mybatis-ignite team would be great.
Edit: If it helps, i have placed a small self contained project # https://github.com/softwarebrahma/MyBatis-Ignite-L2-cache-POC that can be used to reproduce the issues i have mentioned.
I missed mentioning in the repo..but only the Ports table & schema is used for the purposes of the demo the other tables are not used. What happens is that in the file (github.com/softwarebrahma/MyBatis-Ignite-L2-cache-POC/blob/master/domain/src/main/java/com/brocade/dcm/domain/xml/PostsMapper.xml) if i remove the line "cache type="org.mybatis.caches.ignite.IgniteCacheAdapter" />" then everything will work fine without ignite caching. But the moment i add that line as shown in the uploaded file the mapper method calls just hangs.
With an existing Umbraco site running fine we added the nuPickers plugin which does not seem to like Castle. In the browser console we are seeing a lot of 404 / 500 errors being generated for the embedded resources within the plugin. (The plugin is a single DLL with css and js files embedded in it.)
The site continues running fine (back and front ends), except for the plugin.
The Event log is showing: "No component for supporting the service nuPickers.EmbeddedResourceController was found"
We have tried route.ignoreroute in our route config, and also adding a handler in web.config, both unsuccessfully, as we do not think the resource requests should be getting to castle?
Any help or pointers gratefully accepted!
Just in case anyone comes across this ticket, we 'solved' this by
Getting all of the embedded resources, (html, js & css - not the classes)
Physically placing them inside the App_plugins folder in the correct structure (as they were being requested),
Renaming the js and css files (by adding the .nu after the file
extension), and,
Adding the following mime types into the web.config
mimeMap fileExtension=".css.nu" mimeType="text/css"
mimeMap fileExtension=".js.nu" mimeType="application/javascript"
Then, everything seems to work - but there MUST be a better solution, surely?
It seems google cloud storage provides a different behavior whether a folder is access from a web client with or without a trailing /
A simple test shows a different behavior for the following link
http://gstest.tekartik.com/sub/dir (fail to load css - background is white)
http://gstest.tekartik.com/sub/dir/ (works ok - background is black)
Where the bucket has been configured using:
gsutil setwebcfg -m index.html -e 404.html gs://gstest.tekartik.com
For information it contains 3 simple files index.html/404.html/style.css where style.css only set the background to black.
They both correctly "redirect" to the url http://gstest.tekartik.com/sub/dir/index.html. However the relative path does not allow for style.css to be loaded properly in the first case.
What I would like is to have the 1st case to be redirected using a trailing / (which is what Amazon S3 does). What is needed for this to work propertly so that I can give a url to someone without worrying about whether the trailing / is entered?
as a side, this works fine as at the root level (http://gstest.tekartik.com/ got automatically renamed to http://gstest.tekartik.com as here the trailing / is not needed)
I've spoken with the engineering team and we agree this should work the way you expected. This will be fixed in the near term by adding a bucket configuration setting to enable the expected behavior (the extra config step is needed to avoid breaking any apps depending on the current behavior). We're also planning to make it easy to update the new config setting via gsutil. I can't say when exactly these changes will be available but tune into the gs-announce group to monitor these (and other) details about Google Cloud Storage. Thanks for bringing this to our attention.
Update (June 3, 2013): This has now been fixed in production.