static-files

python built in server not loading css

淺唱寂寞╮ 提交于 2019-11-29 11:41:11
when i runserver the django admin is missing css.The web console says that style sheet was not loaded because its MIME type,"application/x-css", is not "text/css". This is my settings.py file Django settings for mysite project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'C:/djangorevision/mysite/sqlite3.db', database 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', 'PORT': '', } } ALLOWED_HOSTS = [] TIME_ZONE =

Tomcat can't see newly created static files and is server-side caching the old files

↘锁芯ラ 提交于 2019-11-29 11:12:15
I use Tomcat 7 on Windows XP. I have a directory with static files (HTML, CSS, JS) in %TOMCATDIR%/webapps/myapplication . They're accessible via localhost:8080/myapplication When a change happens to a file in my server dir, it is not reflected: modified files are returned (200 OK) the same as previously (tested with Fiddler; for sure not a browser cache issue - cleared cache, using different browsers etc.) , newly created files in that directory are not accessible (404). The above happens no matter how many times I try to reload the file, or even add query string to it ( img.jpg?timestamp=...

How to intercept 404 using Owin middleware

狂风中的少年 提交于 2019-11-29 09:19:13
Background First let me explain the background. I am working on a project that attempts to marry a backend server that uses Web API configured via OWIN- hosted on IIS now, but potentially other OWIN-supported hosts in the future- to a frontend using AngularJS. The AngularJS frontend is entirely static content. I completely avoid server-side technologies such as MVC/Razor, WebForms, Bundles, anything that has to do with the frontend and the assets it uses, and defer instead to the latest and greatest techniques using Node.js, Grunt/Gulp, etc. to handle CSS compilation, bundling, minification,

Is it possible to using Image.getSize with static image file?

帅比萌擦擦* 提交于 2019-11-29 06:20:29
问题 I want to use Image.getSize (https://facebook.github.io/react-native/docs/image.html) to get the size of my image but the first argument require the image source to be in URI but I can't use URI with static file, I can only use Require. Therefore, is it possible is to use Image.getSize on static file or do I have to find another way? 回答1: You can use resolveAssetSource (from react-native/Libraries/Image/resolveAssetSource) to get the image's size. import resolveAssetSource from

With Flask, how can I serve robots.txt and sitemap.xml as static files? [duplicate]

ε祈祈猫儿з 提交于 2019-11-28 20:01:48
问题 This question already has an answer here: Static files in Flask - robot.txt, sitemap.xml (mod_wsgi) 9 answers I've read on quiet a few places that serving static files should be left to the server, for example in a couple of the answers on this SO question. But I use the OpenShift PaaS, and can't figure out how to modify the .htaccess file there. I came across this piece of code that serves the sitemap from a template. I did that on my app for both the sitemap, and robots.txt, like so - @app

Static files won't load when out of debug in Django

梦想与她 提交于 2019-11-28 18:23:27
I'm creating a Django project. I just tried taking the project out of debug, DEBUG = False and for some reason all my static files do not show up. They give an error code of 500. How do i fix this? some of settings.py: DEBUG = True TEMPLATE_DEBUG = DEBUG ... TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', # 'django.middleware.csrf.CsrfViewMiddleware', 'django

What is the best practice for serving html in node.js with express.js?

二次信任 提交于 2019-11-28 17:30:51
I currently am serving all my html right in my app.js/server.js file like this: app.get('/', function(req, res) { res.render('index.html'); }); app.get('/about', function(req, res) { res.render('about.html'); }); app.get('/projects', function(req, res) { res.render('projects.html'); }); I imagine if I have 15+ html pages that this is probably not the best way to call them. Is there a better way to serve them from another file or location and using export or something to be able to call just one function or something on app.js. It might be what the routing is for but maybe I do not understand

Django runserver not serving static files in development

断了今生、忘了曾经 提交于 2019-11-28 09:07:12
I am using Django with runserver for my development. When I deploy to my production server I can see all my static files, but not on my local computer. I did collectstatic and I have set DEBUG = True . I found many different opinions online, the most prominent being the STATICFILES_DIRS , but that does not work for me. How can I set it so that in my development environment I can see the static files, and when I upload my files to the server I do not need to make any changes for the production environment to work properly. Edit - my urls.py file: from django.conf.urls import patterns, include,

How can I handle static files with Python webapp2 in Heroku?

旧巷老猫 提交于 2019-11-28 08:31:53
问题 I am now migrating my small Google App Engine app to Heroku platform. I don't actually use Bigtable, and webapp2 reduces my migration costs a lot. Now I'm stuck on handling the static files. Is there any good practices? If so, lead me there please. Thanks in advance. EDIT Well, I'm now using paste for my WSGI server. And paste.StaticURLParser() should be what I need to implement static file handler. However I have no idea how to integrate it with webapp2.WSGIApplication() . Could anyone help

'collectstatic' command fails when WhiteNoise is enabled

旧巷老猫 提交于 2019-11-28 06:50:46
I'm trying to serve static files through WhiteNoise as per Heroku 's recommendation. When I run collectstatic in my development environment, this happens: Post-processing 'css/iconic/open-iconic-bootstrap.css' failed! Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/__init__.py",