static-files

My app quits serving static files after the Windows April Update

这一生的挚爱 提交于 2021-02-18 18:43:06
问题 I have an app where the Content folder is filled by another process that builds a frontend app, and the Visual Studio project itself doesn't know what's in the folder. I set up the web.config with a standard <staticContent> node and <modules runAllManagedModulesForAllRequests="true"> . I have my RouteConfig set up with routes.IgnoreRoute("content/*"); The app typically runs with IIS Express, but I have also run it with IIS proper. This has all worked fine to load js, css, and other static

My app quits serving static files after the Windows April Update

大兔子大兔子 提交于 2021-02-18 18:42:15
问题 I have an app where the Content folder is filled by another process that builds a frontend app, and the Visual Studio project itself doesn't know what's in the folder. I set up the web.config with a standard <staticContent> node and <modules runAllManagedModulesForAllRequests="true"> . I have my RouteConfig set up with routes.IgnoreRoute("content/*"); The app typically runs with IIS Express, but I have also run it with IIS proper. This has all worked fine to load js, css, and other static

How to serve static files in FastAPI

别等时光非礼了梦想. 提交于 2021-02-10 20:57:26
问题 I am trying to serve static files that I have in a package_docs directory. When I open in the browzer: http://127.0.0.1:8001/packages/docs/index.html , the page is running. But I want to open the page: http://127.0.0.1:8001/packages/docs/ without the source file. And the output is 404 Not Found app.mount("/packages/docs", StaticFiles(directory=pkg_resources.resource_filename(__name__, 'package_docs') ), name="package_docs") @app.get("/packages/docs/.*", include_in_schema=False) def root():

Custom role to link PDF file as static content

喜你入骨 提交于 2021-01-29 10:51:19
问题 I am trying to write a custom role for Sphinx to allow linking to PDF files that are then displayed in the browser (rather than being downloaded when using the :download: role). I have got as far as a role that creates a link to the PDF file: :pdf:`Document Title <pdf/document.pdf>` generates something like: <a href="pdf/document.pdf>Document Title</a> However, I don't know how to get Sphinx to copy the pdf directory to the output directory. Is this possible? 回答1: Use html_static_path in your

Secure requests to .html files in ASP.NET Core

与世无争的帅哥 提交于 2021-01-29 06:10:19
问题 I have a web application written in ASP.NET Core. Authentication is done by checking if the Session contains a Json object that is obtained from a webservice at the first request. (using public/private keys etc.) Inside this Json object is a number that corresponds with a physical folder beneath the Web root folder. So, when a user accessing files within this folder it should check if this is allowed. In fact, there is a whole static website within this folder, so every request to an .html

React (CRA) SW Cache “public” folder

大憨熊 提交于 2020-12-30 05:34:05
问题 After executing the create-react-app and enabling the service workers in the index.js , all relevant files from the src folder are cached. However some of my resources reside in the public directory. When I run npm run build , the asset-manifest.json and precache-manifest.HASH.js only contain the HTML, mangled JS and CSS (all stuff from the src folder). How can I tell the service worker to additionally cache specific files from the public folder? Here is the actually generated precache

Gunicorn with Django giving a problem with static files

三世轮回 提交于 2020-08-24 04:51:43
问题 Got a Django project named django_server. When I run python manage.py runserver the page shows up as expected Then, if I run gunicorn django_server.wsgi:application --bind 0.0.0.0:8000 The page shows without styling Checking the console, can see the following errors for both .css and .js files The resource from “http://0.0.0.0:8000/static/....css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). In the terminal where the gunicorn command was executed, can

Gunicorn with Django giving a problem with static files

此生再无相见时 提交于 2020-08-24 04:51:07
问题 Got a Django project named django_server. When I run python manage.py runserver the page shows up as expected Then, if I run gunicorn django_server.wsgi:application --bind 0.0.0.0:8000 The page shows without styling Checking the console, can see the following errors for both .css and .js files The resource from “http://0.0.0.0:8000/static/....css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). In the terminal where the gunicorn command was executed, can

How to serve static files in Flask

心不动则不痛 提交于 2020-08-20 14:58:23
问题 So this is embarrassing. I've got an application that I threw together in Flask and for now it is just serving up a single static HTML page with some links to CSS and JS. And I can't find where in the documentation Flask describes returning static files. Yes, I could use render_template but I know the data is not templatized. I'd have thought send_file or url_for was the right thing, but I could not get those to work. In the meantime, I am opening the files, reading content, and rigging up a