WhiteNoise + Lambda + Zappa
See original GitHub issueHello Guys,
We are using Zappa + Django in AWS Lambda. I really like the idea of using whitenoise, at least for serving our Django admin pages, it sounds to me like a simple solution that does not require a lot of configuration (like similar S3 solutions).
I followed the tutorial and tried the following with no avail:
settings.py
-----------
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
$ zappa manage production collectstatic
...
error stack
...
Read-only file system: '/var/task/staticfiles'
Well makes sense, from what I know the only writeable directory is /tmp so I tried
STATIC_URL = '/static/'
STATIC_ROOT = /tmp/staticfiles'
...
$ zappa manage production collectstatic
61 static files copied to '/tmp/staticfiles'.
[END] RequestId: 4b9c1c60-ddc4-11e7-a97d-e193c05b0571
[REPORT] RequestId: 4b9c1c60-ddc4-11e7-a97d-e193c05b0571
Duration: 77.20 ms
Billed Duration: 100 ms
Memory Size: 512 MB
Max Memory Used: 44 MB
When go to my-site.com/admin
I’m getting 403 when trying to retrieve the resources which again makes sense.
So what is the correct way to implement it ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Using WhiteNoise for static files - Serverless Django with Zappa
We are mostly following the Using WhiteNoise with Django guide here, but with some specific changes for the Lambda environment.
Read more >whitenoise with zappa, push static files to s3? - Stack Overflow
manually push WhiteNoise's static content to an S3 bucket and have Cloudfront have this as an origin, and dont upload the 100MB to...
Read more >Hosting Static Files - Guide to using Django with Zappa
Normally, Django treats URL requests as an opportunity to run python code. And the python code may have complex logic. But there is...
Read more >Sanjay Siddhanti on Twitter: "Zappa is a free, open-source ...
I wrote a post about deploying Python web apps on Lambda. ... I recommend using Zappa to handle all the setup instead. 3/...
Read more >What should I keep in my mind before deploying my Django ...
Zappa's default deployment adds this, but you could make it more frequent. Don't serve static files through lambda even with whitenoise, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Using WhiteNoise, Zappa and Django
production
profile inzappa_settings.json
settings.py
add./manage.py collectstatic
zappa update
Did you try your config using the STATIC_HOST with cloudfront as CDN?