Thanks for replies!

I'm aware of Docker solution, but it's not quite what I'm looking for.
I don't have any control of a production server, I don't have sudo and I can't 
install any packages. It also concerns Docker, since it could be not installed.
And yes, OS is always Ubuntu Linux in my case, but version is not fixed, so two 
servers could have different Ubuntu versions.

I'm looking for something universal, like Go programs - you get one binary with 
all libraries included. It seems to me that utils like cx_freeze or py2exe do 
that, but they don't work with Django, since you need to expose WSGI 
application to WSGI server (gunicron/uWSGI/etc).

Like I said in first letter, virtualenv does provide a solution for this setup, 
but there's too much work to be done and you have to explicitly set 
LD_LIBRARY_PATH on production server.

> On 19 Oct 2016, at 12:40, Jani Tiainen <rede...@gmail.com> wrote:
> 
> 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.
> 
> On 18.10.2016 21:45, Александр Христюхин wrote:
>> 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 
>> <http://stackoverflow.com/questions/39913847/is-there-a-way-to-compile-python-application-into-static-binary/>
>>  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+unsubscr...@googlegroups.com 
>> <mailto:django-users+unsubscr...@googlegroups.com>.
>> To post to this group, send email to django-users@googlegroups.com 
>> <mailto:django-users@googlegroups.com>.
>> Visit this group at https://groups.google.com/group/django-users 
>> <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
>>  
>> <https://groups.google.com/d/msgid/django-users/51a3ef5f-800a-48db-9697-03d069238834%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout 
>> <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+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <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
>  
> <https://groups.google.com/d/msgid/django-users/2d22ef8d-57ff-687b-d355-b4cdaf7c4f4d%40gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to