django-staticfiles

Identical and simple way of serving static files in development and production - is it possible?

丶灬走出姿态 提交于 2019-12-13 17:40:47
问题 Is it possible to have static files only in PROJECT_DIR/static directory without duplicates of static files in app dirs and without needing to do collectstatic command? On local computer Django dev server is used, in production - some other web server. From what I have read so far I decided that it's impossible, but maybe it's not true. 回答1: Of course it's possible.. the static files app is there to be useful. If you dont like "duplicates" (that's the whole point - you can have files per app,

Deploying Django to AWS; static files for dummies

独自空忆成欢 提交于 2019-12-13 06:39:04
问题 I am utterly lost on one of the last steps of this project. So far, I've been able to develop a django app that works the way I want it to on localhost; I've been able to deploy the website to AWS EC2, but I must be missing something fundamental about serving the static files. (I haven't even tried media files yet.) I've read the Django Deployment page and How-To manage static files, but I have never deployed a website from scratch before. The tutorials I've found seem to be contradicting (or

Loading images in a static file

隐身守侯 提交于 2019-12-13 05:51:04
问题 So I have completed the Django tutorial, play around with it some, and feel that I have a good understanding of Django. The only problem I am facing is that when I try to display a static page for a landing page, I cannot seem to get any images to load. First off I have tried two different methods of displaying a static landing page. First: # main app urls.py from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('',

Django gives 404 error when loading static files AFTER jquery .load is called

一个人想着一个人 提交于 2019-12-13 05:50:00
问题 I have an html file located at /static/templates/usersPostsSection.html in my app directory. The first few lines of usersPostsSection.html are: {% load static %} <link rel='stylesheet' type='text/css' href="{% static 'css/cssReset.css' %}" /> <link rel='stylesheet' type='text/css' href="{% static 'css/homePageBase.css' %}" /> <script type='text/javascript' src="{% static 'js/jquery.js' %}"></script> <form class='voteForm' method="post" action="/post/likePost/">{% csrf_token %} <button class=

Django and OpenShift static files can't be found

梦想与她 提交于 2019-12-13 04:59:37
问题 So I followed this tutorial: https://github.com/rancavil/django-openshift-quickstart/wiki/Tutorial-How-create-an-application-with-Django-1.6-on-Openshift and I tried to add a static image to the default home.html page and it just won't find it. HTML: {% load static %} <html> <head> </head> <body> <img src="{% static 'Logo_Trans.png' %}"> <div class="left"></div> <div class="right"> <p>is coming soon</p> </div> </body> </html> All other files are as listed in the repo given. 回答1: I've found

Unable to serve static files correctly in Django app

若如初见. 提交于 2019-12-13 03:39:11
问题 I have installed in googlecloud VM (Ubuntu 16.04) a django application (1.8.19) with a static IP but when I access the page I am not able to load correctly all the static files (css, jquery etc.). Although I have set the correct files paths in my apache conf file, the URLs fail to include the "static" part. So instead of being like this: http://myip/**static**/lib/css/assets.min.css They are like this: http://myip/lib/css/assets.min.css Thus everything fails to get rendered correctly and I

Django 1.4 static files problems and don't render at other urls of my project

拜拜、爱过 提交于 2019-12-12 14:33:36
问题 Here are my settings: STATIC_ROOT = "/home/tony/Documents/mysite/mysite/" STATIC_URL = '/static/' STATICFILES_DIRS = ( "/home/tony/Documents/mysite/mysite/static/", ) And here I refer my stylesheet(This gives me an error): <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/reset.css" /> <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/style.css" /> And the error in the log: [06/Apr/2012 13:36:09] "GET /css/reset.css HTTP/1.1" 404 2193 [06/Apr/2012 13:36:09]

static files in django 1.6 not found

孤人 提交于 2019-12-12 02:46:26
问题 I'm just starting with django 1.6 and my css is not working neither my images, I get a 404 error, even the admin(s css is not working Here is my file structure : myproject --myproject ----templates --static ----css ----media --myapp --mp.db --manage.py This is my base.html : <link rel="image_src" href="{% block image_src %}http://{{ request.META.HTTP_HOST }}/static/images/logo.png{% endblock %}" /> <link rel="stylesheet" media="screen" href="{{ STATIC_URL }}css/utils.css"> <link rel=

django documentation, serving static files, 3 simple steps? Nope

大憨熊 提交于 2019-12-12 02:12:51
问题 https://docs.djangoproject.com/en/1.3/howto/static-files/ Trying to serve static files i was put on to the above link. The link tells me when serving static files in development Put your static files where they will be found, 'home/jamie/mysite/static/' Done! 2.Make sure that django.contrib.staticfiles is included in your INSTALLED_APPS. For local development, if you are using runserver... you’re done with the setup . Done! 3.You’ll probably need to refer to these files in your templates. The

Serving django static files in development envirnoment

随声附和 提交于 2019-12-12 01:57:29
问题 I want to use static files to load my css with runserver command. The problem is that i tried all the solution i found here on stackoverflow and also in django docs, but it doesnt works at all... I dont know what can i do... If i set STATIC_URL = '/static/' STATIC_ROOT = 'C:\Users\Max\Works\www\mysite\mysite\static' INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles'