Stop assets from being precompiled locally for local production testing of a heroku rails asset_sync s3 app

帅比萌擦擦* 提交于 2019-12-11 04:19:17

问题


This app is deployed on heroku and uses asset_sync gem with s3 to serve assets. I want to run my rails server in production locally to test out things before deployment to heroku. When I run rake assets:precompile My local machine uploads files to my s3 bucket (all works fine) but I also notice assets are precompiled in my local public folder.

Precompiling on S3 and locally seems redundant, sometimes I want the assets precompiled to just S3, other times I may want to run a local production server with assets from my public directory and not bother uploading / referencing S3.

So how would I configure my machine to stop assets from being precompiled locally?

I'm open to any ways to configure my system. Right now

I added several variables to my .bash_profile to store my AWS credentials.

export AWS_ACCESS_KEY_ID=xxx
export AWS_SECRET_ACCESS_KEY=yyy
export S3_BUCKET_NAME=my_bucket_name
export FOG_PROVIDER=AWS
export FOG_DIRECTORY=my_bucket_name

I've tried a rails environment/production.rb entry:

config.serve_static_assets = false

Thanks

来源:https://stackoverflow.com/questions/13755311/stop-assets-from-being-precompiled-locally-for-local-production-testing-of-a-her

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!