static-files

Django — Can't get static CSS files to load

爷,独闯天下 提交于 2019-11-26 10:32:45
问题 I\'m running Django\'s development server ( runserver ) on my local machine (Mac OS X) and cannot get the CSS files to load. Here are the relevant entries in settings.py: STATIC_ROOT = \'/Users/username/Projects/mysite/static/\' STATIC_URL = \'/static/\' STATICFILES_DIRS = ( \'/Users/thaymore/Projects/mysite/cal/static\', ) STATICFILES_FINDERS = ( \'django.contrib.staticfiles.finders.FileSystemFinder\', \'django.contrib.staticfiles.finders.AppDirectoriesFinder\', #\'django.contrib.staticfiles

How to set-up a Django project with django-storages and Amazon S3, but with different folders for static files and media files?

点点圈 提交于 2019-11-26 07:53:17
问题 I\'m configuring a Django project that were using the server filesystem for storing the apps static files ( STATIC_ROOT ) and user uploaded files ( MEDIA_ROOT ). I need now to host all that content on Amazon\'s S3, so I have created a bucket for this. Using django-storages with the boto storage backend, I managed to upload collected statics to the S3 bucket: MEDIA_ROOT = \'/media/\' STATIC_ROOT = \'/static/\' DEFAULT_FILE_STORAGE = \'storages.backends.s3boto.S3BotoStorage\' AWS_ACCESS_KEY_ID

How to serve static files in Flask

亡梦爱人 提交于 2019-11-25 22:13:53
问题 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