How should I set up my dev enviornment for a django app so that I can pull on static s3 files?

I'm having trouble in establishing an ideal setup where I can distinguish between production and test environment for my django app.

I'm using a postgresql database that stores a relative file path to a s3 bucket after I upload an image. Am I supposed to make a production copy of all the files in the s3 bucket and connect my current development code to this static directory to do testing? I certainly don't want to connect to production ... What's best practice in this situation?

Also I may be doing things wrong here by having the file path in a postgresql database. Would it be more ideal to have some foreign key to a mongodb table which then holds the file path for the file path in aws s3?

Another best practice question is how should the file path should be organized? Should I just organize the file path like the following:

~somebucket/{userName}/{date}/{fileNameName}

OR

~somebucket/{userName}/{fileName}

OR

~somebucket/{fileName}

OR

~somebucket/{date}/{userName}/{fileNameName}

OR

~somebucket/{fileName} = u1234d20140101funnypic.png ??

This is really confusing for me on how to build an ideal way to store static files for development and production. Any better recommendations would be greatly appreciated.

Thanks for your time :)

Answers


Its good to have different settings for production and dev. So you can just create a settings folder and have settings may be prod.py and dev.py. this will let you use diff apps for eg: you actually don't need debug tool bar on prod.

And regarding the file, I feel you dont have to worry about the structure as such, you can always refer to Etag and get the file (md5 hash of the object)


Need Your Help

Speeding up a MySql DELETE that relies on a BIT column

mysql optimization innodb sql-delete bit

I’m using MySql 5.5.46 and have an InnoDB table with a Bit Column (named “ENABLED”). There is no index on this column. The table has 26 million rows, so understandably, the statement

ActionScript - MouseOut Event

actionscript-3 mouseover

I am trying to get a movie clip to play properly. The first part with MouseOver works fine, but the MouseOut doesn't get a response.