static-files

ASP.NET MVC application gives Internal Server Error only when viewed in Firefox

醉酒当歌 提交于 2019-12-04 16:24:10
问题 (I'm new to .Net and the Microsoft world in general, coming from a Java and Tomcat background, so please bear that in mind.) I'm working on my first .Net application, using Visual Studio 2013, C#, .Net 4.5, MVC 5, and EF 6. It's a fairly simple web-based application, using Windows authentication and Active Directory groups for authorization to do fairly basic CRUD operations on a table in a SQL Server database. I haven't deployed the application yet. I'm still developing it and testing it out

Problems linking to static files in Django 1.3

£可爱£侵袭症+ 提交于 2019-12-04 14:20:20
问题 I'm running django 1.3, python 2.7 on windows XP I'm trying to setup a css in a static folder for my django app. The template looks like: <html> <head> <title>css demo</title> <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/my.css" /> </head> <body> The generated HTML looks like: <html> <head> <title>css demo</title> <link rel="stylesheet" type="text/css" href="http://localhost/static/css/my.css" /> </head> ... So it appears that I have everything set up in order to specify

Render JavaScript to HTML in Python?

只谈情不闲聊 提交于 2019-12-04 13:01:30
What My web-app is made dynamic through Google's AngularJS . I want static versions of my pages to be generated. Why Web-scrapers like Google's execute and render the JavaScript; but don't treat the content the same way as their static equivalents. References: Does heavy JavaScript use adversely impact Googleability? (Programmers StackExchange) Making AJAX Applications Crawlable (Google Documentation for webmasters) How Not sure exactly how—which is why I'm asking—but I want to access the same source that your browser's 'inspect element' presents; rather than the source that: Ctrl + U (View

ASP.NET Core - serving static files [duplicate]

喜欢而已 提交于 2019-12-04 11:06:49
This question already has an answer here: .NET Core changing the location where my default index.html file is 2 answers I'm following this documentation but I'm getting stuck: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files Consider my directory structure: wwwroot dist index.html In my startup class, I have: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseDefaultFiles(); app.UseStaticFiles(); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider

Can I gzip JavaScript and CSS files in Django?

亡梦爱人 提交于 2019-12-04 10:23:31
I tried profiling my web application and one of the bottlenecks reported was the lack of gzip compression. I proceeded to install the gzip middleware in Django and got a bit of a boost but a new report shows that it is only gzipping the HTML files i.e. any content processed by Django. Is there a way I could kludge/hack/force/make the middleware gzip my CSS and my JS as well? Could someone please answer my questions below. I've gotten a little lost with this. I might have gotten it wrong but people do gzip the CSS and the JS, don't they? Does Django not compress JS and CSS for some browser

Serve files from folder outside web application in Jetty

本秂侑毒 提交于 2019-12-04 08:01:24
问题 I have a Java web application (Eclipse/OSGI) on a Jetty server. I want to be able to serve static files to my web application from a folder outside of the web root. In my web application, I don't yet know the file name of the file I want to be served, so I want to take the filename (and/or path) as a VM parameter when I start my web application. For example: I have an image - myImg.jpg - that I have put in a folder on the server file system, for example root/images/myImg.jpg. I want to take

Django - Static Files from App Directories

给你一囗甜甜゛ 提交于 2019-12-04 06:56:09
In a development environment, I'd like to use static files from the app directories. #settings.py SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) STATIC_ROOT = (os.path.join(SITE_ROOT, 'static_files/')) STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(SITE_ROOT, 'static/'), ) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ) TEMPLATE_CONTEXT_PROCESSORS = ( #... 'django.core.context_processors.static', #... ) INSTALLED_APPS = ( #... 'django.contrib.staticfiles', #... ) I can find my static

How can Tornado serve a single static file at an arbitrary location?

这一生的挚爱 提交于 2019-12-04 02:40:42
I am developing a simple web app with Tornado. It serves some dynamic files and some static ones. The dynamic ones are not a problem, but I am having trouble serving a static file. What I am looking to do is to serve the file /path/to/foo.json when the /foo.json URL is accessed. Note that /path/to/foo.json is outside the document root. In Apache I would just set up an Alias. With Tornado I have: app = tornado.web.Application([ (r'/dynamic\.html', MyService, dict(param = 12345)), (r'/(foo\.json)', tornado.web.StaticFileHandler, {'path': '/path/to/foo.json'}) ]) I added the regex group operator

Leverage browser caching with web.config in .net?

十年热恋 提交于 2019-12-04 02:19:35
Some of sites are on shared hosting (Windows 2003 Server), so I have no way to access server configuration. I read everywhere about leverage browser caching, expecially for static files (jpg, css, js, etc.) but... how to do this in my case? The hosting has .NET installed, could a web.config file help in some way? If yes, how? Here is how I did on my site that is on a shared host. I believe the cacheControlMaxAge is as follows days:hours:minutes:seconds but dont quote me. <system.webServer> <staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="3.00:00:00" /> <

Connection reset by peer when using s3, boto, django-storage for static files

久未见 提交于 2019-12-03 22:20:45
I'm trying to switch to use amazon s3 to host our static files for our django project. I am using django, boto, django-storage and django-compressor. When I run collect static on my dev server, I get the error socket.error: [Errno 104] Connection reset by peer The size of all of my static files is 74MB, which doesnt seem too large. Has anyone seen this before, or have any debugging tips? Here is the full trace. Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/_