Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where does django install in ubuntu

I am looking for the init.py file for django. I tried whereis and find, but I get a lot of dirs.

like image 883
Kevin Avatar asked Jul 08 '09 01:07

Kevin


People also ask

Where is Django installed?

Django can be installed easily using pip . In the command prompt, execute the following command: pip install django . This will download and install Django. After the installation has completed, you can verify your Django installation by executing django-admin --version in the command prompt.

How do I know if Django is installed on Ubuntu?

Simply type python -m django --version or type pip freeze to see all the versions of installed modules including Django.

Where are Django projects stored Linux?

There is no answer to this question. It's linux, it goes where you need it to go. I put mine in /var/django. Put it wherever it makes the most sense/is the most secure.


4 Answers

you can just print it out.

>>> import django
>>> print django.__file__
/var/lib/python-support/python2.5/django/__init__.pyc
>>>

or:

import inspect
import django
print inspect.getabsfile(django)
like image 141
sunqiang Avatar answered Oct 02 '22 09:10

sunqiang


This (or something like this) also works when you are searching for files in other packages:

$ dpkg -L python-django | grep __init__.py
like image 39
0x89 Avatar answered Oct 02 '22 09:10

0x89


Its now at

/usr/lib/python2.7/dist-packages/django/....

circa 2012

like image 25
Bkat Avatar answered Oct 02 '22 09:10

Bkat


A one-liner command (which is given in the django docs) to find where your django source files are:

$ python -c "import django; print(django.__path__)"
like image 24
doru Avatar answered Oct 02 '22 08:10

doru