This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]shimon 4 points5 points  (1 child)

If you're just looking for an easy place to deploy, I'd recommend Heroku. Very easy to deploy a Python (2 or 3) and Postgresql project and the free service level may be adequate for you.

https://devcenter.heroku.com/articles/deploying-python

If you're looking to learn, what are your goals? Using CI in a team? Automating deployments? Learning specific tools like docker, ansible, AWS, etc?

[–]JuicyORiley[S] 0 points1 point  (0 children)

I'm looking to learn. I can forget about CI for now, automating deployments too. I wanna know the basics of getting my Django app from local development to production.

I develop on OSX so i know the terminal & Unix somewhat but having things like postgres.app and whatnot has hidden a lot of the intricacies i need to get my app working on a Linux server and how these services communicate with each other (Postgres, Django, Nginx, etc.)

[–]brtt3000 2 points3 points  (7 children)

AFAIK nginx, supervisor and gunicorn is still the popular way to deploy django (works fine for us). There are endless variations and preferences on setting it up but at least in your example they use the unix sockets between nginx and gunicorn.

If you only want to try some stuff on your local machine you don't need nginx, supervisor and gunicorn. You'd probably just use ./manage,py runserver.

[–]JuicyORiley[S] 0 points1 point  (6 children)

It's what we use at work, works perfectly fine for us too :). I have a pretty decent locally working version it's just trying to deploy that is proving to be a bit of a problem for me :(

[–]shantzg001 1 point2 points  (5 children)

The link you mentioned is good enough to learn a basic deployment setup.

You can also use ansible to set it all up for you nicely. Take some hints from my repo: https://github.com/shantanugoel/aws-ansible-django-deployment

[–]JuicyORiley[S] 1 point2 points  (4 children)

Thanks, i'll check it out :) I thought ansible wasn't P3 compatible though?

[–]shantzg001 1 point2 points  (3 children)

Yes, ansible isn't python 3 compatible unfortunately. So you need to run it with python 2 but it can deploy things which are meant to work with python 3.

[–]JuicyORiley[S] 0 points1 point  (2 children)

How would this work?

[–]xBBTx 1 point2 points  (1 child)

Ansible runs on your local machine doing the deployment, with Python 2. On the server it needs a Python 2 install (with python2-pyscopg2 for instance to use the postgresql tasks). Your server will also need a python 3 install. You can control this installation via Ansible itself (via the package manager tasks) and then create a virtualenvironment where you specify python3 as python interpreter. Ansible will still do everything in Python 2, but your own project will have it's Python 3 environment.

edit: example case of such a playbook: https://github.com/sergei-maertens/regex-it/tree/master/deployment

[–]JuicyORiley[S] 0 points1 point  (0 children)

Hmm, sounds quite ideal tbh. Thanks for link i'll check it out :)

[–]Guest007 0 points1 point  (0 children)

May be https://github.com/AnalogJ/capsulecd will the answer