Featured post
git - Hosting-specific code in projects: push to Github too? -
imagine common scenario: hacked cool project want share world. so: put on github, , fetch github on own website people can see demo. makes updating easy: push local box github, fetch on server.
i'd track visitors add google analytics , maybe other site-specific stuff (like global header pages on site) project. however, checks out project github gets stuff too.
there few solutions prevent that. make specific 'deployment branch' website, that's cumbersome. make kind of switch in code (if ip === myip showstats()
), that's ugly.
another option might use githooks, haven't got experience that.
any other suggestions? people bothered when getting deployment-specific code in checkouts?
similar breun's suggestion, (so question double answered) deploy python projects settings.py file defines settings needed on production machine. (debug=false, proper database settings , file paths...)
at end of file, try import developmentsettings.py this:
try: projectnaam import developmentsettings except: pass
the file not exist in version control, fail , silently pass on server. on dev machine, manually create file , override specific settings match dev needs. (things sqlite instead of postgres)
this can extended more sophisticated deployment strategy, involving stuff fabric, buildout, capistrano , chef. gets more important when working in (distributed) teams.
my current development flow goes like: edit code, $ git commit -m "comment", $ git push, $ fab deploy master production (<- pulls 'master' origin onto server)
- Get link
- X
- Other Apps
Comments
Post a Comment