meatballs/DjAxelrod

Basic Django Setup

Closed this issue · 7 comments

Installation of Django 1.8 and basic settings and setup

Can I suggest we set up a virtualenv and a requirements file etc for this? With web based stuff I think that's important...

Absolutely!!

I'm going to get that sort of stuff properly in place before I push anything against this ticket.

Basics are done and pushed. Feedback would be much appreciated!

I've used dj-database-url as heroku will require it anyway and I've hacked manage.py to read environment variables from a .env file so that nothing private is included in the repository.

How usual is it to tweak the manage.py etc? Just thinking that if we hope to get people to add to this, would it be worth staying as close to default behaviour as possible?

How usual is it to tweak the manage.py etc?

Interesting question!! There are two flavours of answer:

  1. For this project, the hack is temporary. It becomes redundant once vagrant is up and running.

  2. I reckon it's common for anyone coming from a Rails background - Rails does this better! I was thinking of finding someone at djangocon to discuss it with and possibly offering it as a contribution to django itself.

Quick explanation of what the hack does:

There are some settings in settings.py which shouldn't be make public (e.g. SECRET_KEY) and, therefore, should not be under version control. The better way to handle those is with environment variables but that's more complex to configure for new developers and a right pain if you have more than one project on your local machine.

Rails handles this by using a .env file to contain those entries and it's included in .gitignore by default. Rails will look for either a genuine environment variable or an entry in that file for its info. The hack to manage.py makes django behave in the same fashion.

  1. For this project, the hack is temporary. It becomes redundant once vagrant is up and running.

Cool 👍

And yeah I think I don't know enough of all this yet to be able to comment any further. All sounds sensible to me though.