I am looking for the init.py file for django. I tried whereis and find, but I get a lot of dirs.
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.
Simply type python -m django --version or type pip freeze to see all the versions of installed modules including Django.
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.
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)
This (or something like this) also works when you are searching for files in other packages:
$ dpkg -L python-django | grep __init__.py
Its now at
/usr/lib/python2.7/dist-packages/django/....
circa 2012
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__)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With