Hi!
I would like to ask community about methods of shipping Django in production.
I do have some limitations, one of which is I don't know what packages are installed on production server (for example, postgres dev libraries or specific version of python).
Right now my method is to create venv with specific version of Python, make venv relocatable, copy missing libraries into venv/lib, pack it into archive and ship to production servers.
On application launch server has to unpack archive and run it somewhat like that:
$ LD_LIBRARY_PATH=venv/lib venv/bin/python venv/bin/gunicorn -c gunicorn.conf myapp.wsgi:application
In my case LD_LIBRARY_PATH is required for libpython and libpq (PostgreSQL query library).
This does work, but I have to go through a lot of stuff.
What I want to do is pack my application with specific python and libraries into one binary (on build server) and only ship this binary to production server. So application launch will look somewhat like that:
$ my-awesome-python-bin gunicorn -c gunicorn.conf myapp.wsgi:application
Or if I could go even further and describe some startup logic:
def startup():
...
args = argparser.parse()
config = args.config
gunicorn.server(config, myapp.wsgi, 'application').run()
...and then:
$ my-awesome-bin -c myapp.conf
Is there any way of doing that?
Or could you suggest any easier (well, more convenient) way of shipping Django?
I did ask practically the same question on StackOverflow couple weeks ago, but none of given answers provide simple solution for my problem. I've tried nuitka, pyinstalled and cx_freeze with no success.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51a3ef5f-800a-48db-9697-03d069238834%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I do have some limitations, one of which is I don't know what packages are installed on production server (for example, postgres dev libraries or specific version of python).
Hi,
What do you know about the production server? Do you know the
operating system? Can you become a superuser? If not, how are you
going to configure the web server? If yes, why can't you install
the packages you want?
Antonis Christofides djangodeployment.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
Hi,
Like someone else already pointed out, Docker containers are
quite powerful feature to do deterministic deployments to
unix-like machines. Only pre-requirement is to have Docker running
on target machine but otherwise you're free to build your
containers as you wish. This also eliminates quite nicely "works
for me" problems.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51a3ef5f-800a-48db-9697-03d069238834%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Jani Tiainen
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2d22ef8d-57ff-687b-d355-b4cdaf7c4f4d%40gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51a3ef5f-800a-48db-9697-03d069238834%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Jani Tiainen
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2d22ef8d-57ff-687b-d355-b4cdaf7c4f4d%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/35FCB771-1696-4C24-B5AB-ADB862EF701B%40gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6tJk7u0k3%3De5Vww_FevZKCLhQFMmDc2fV2_jGov3613tHg%40mail.gmail.com.
Hi,
If that's truely the case that you don't control anything,
deploying Django will be really a hard problem.
How do you can make sure that you can install all the libs your Django app, or any dependencies you may have are installed correctly?
How you do setup static file serving?
How you plan to run your Django app itself?
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/FDF7452A-7204-48B2-9C41-F95C8AC9C387%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
-- Jani Tiainen
How do you can make sure that you can install all the libs your Django app, or any dependencies you may have are installed correctly?
How you do setup static file serving?
How you plan to run your Django app itself?
Also, how you can set LD_LIBRARY_PATH if you don't know if there is even libpq5 in the system, or is it even a correct version?
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/046959dc-7cb3-2c1a-0633-df9026e57b48%40gmail.com.
How do you can make sure that you can install all the libs your Django app, or any dependencies you may have are installed correctly?
I'm installing dependencies in virtualenv.How you do setup static file serving?
I'm shipping Nginx binary and config along with app. Static files are collected and archived on build server, then shipped with app and Nginx.
I've posted this in my first message, currently I'm running Django with gunicorn with virtualenv's Python.How you plan to run your Django app itself?
Also, how you can set LD_LIBRARY_PATH if you don't know if there is even libpq5 in the system, or is it even a correct version?
I'm not relying on system's libpq5, that's why I copy it to venv/lib and use LD_LIBRARY_PATH. So it would be loaded from venv/lib and not from the system.
To clarify, my current setup works in hostile environments where I could only rely on OS distro. What I'm looking for is alternative to virtualenv.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/69EE59E6-E7D2-4FD6-9B6C-F545F83574B7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
-- Jani Tiainen
What if system libraries are not the same as yours, you're not shipping all dependencies, including distribution libs as well?
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4550e004-d127-0a0f-7816-9fc3727bb513%40gmail.com.