Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running django project without django installation

I have developed a project with Django framework(python and mysql DB) in Linux OS(Ubuntu 12.04), I want to run this project in localhost in another machine with Linux(Ubuntu 12.04) without installing Django here, is it possible run a django project without django installation. Is there any way to run so?

Thanks in advance.

like image 913
kartheek Avatar asked Nov 08 '12 15:11

kartheek


2 Answers

In order to be able to use regular Django, it has to be installed since you have to be able to do import django. However it is never a good idea to install Django as a system-level Python package. It is always best to work with virtualenvs. They allows you to work on multiple projects where each project might require different packages to be installed, and different projects might require to use different version of the same package. In addition to being used development, virtualenvs are very useful to install packages on remote machines even if you do not have root privileged.

All you have to do is download virtualenv.py and then do the following on the remote machine:

$ wget https://raw.github.com/pypa/virtualenv/master/virtualenv.py
$ python virtualenv.py venv
$ cd venv
$ source bin/activate
$ pip install django

That will create a virtualenv, into which you can install any Python packages without a need for root privileges. More about virtualenv here.

like image 145
miki725 Avatar answered Nov 09 '22 12:11

miki725


You can try DjangoOnAStick or portablepython. Both don't require an installation to work. You can also try PyRun it's a One file Python Runtime that also doesn't need installation you can watch a video about it by the creator.

like image 3
Marwan Alsabbagh Avatar answered Nov 09 '22 14:11

Marwan Alsabbagh