169👍
in the CLI you can do this:
>>> import django
>>> django
<module 'django' from '/usr/local/lib/python2.6/dist-packages/django/__init__.pyc'>
30👍
$ python
>>> import django
>>> django.__file__
'/usr/local/lib/python2.7/site-packages/django/__init__.pyc'
- [Django]-Django TextField and CharField is stripping spaces and blank lines
- [Django]-Django Multiple Authentication Backend for one project
- [Django]-Using Cloudfront with Django S3Boto
14👍
- [Django]-How to get superuser details in Django?
- [Django]-Django: Filter a Queryset made of unions not working
- [Django]-Django models: Only permit one entry in a model?
13👍
On Microsft-Windows OS: In the Lib/site-packages folder inside your python installation.
- [Django]-Django-debug-toolbar not showing up
- [Django]-Multiple annotate Sum terms yields inflated answer
- [Django]-Cron and virtualenv
7👍
As the comments on @olafure’s answer https://stackoverflow.com/a/12974642/4515198 rightly say, the sys.path
assignment is not required.
The following will be enough:
python -c "import django; print(django.__path__)"
Here the -c
option is used to tell python that a “program is being passed in as string” (source: command $ python --help
on bash
)
- [Django]-DateTimeField doesn't show in admin system
- [Django]-IOS app with Django
- [Django]-Django CSRF check failing with an Ajax POST request
4👍
This approach I am describing works across operating systems…
You try this on your command line – python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
This gives you the base directory. From there, type /django/
and here you find all the default templates, admin templates, etc.
Hope this helps…
- [Django]-Annotate with latest related object in Django
- [Django]-Best practices for adding .gitignore file for Python projects?
- [Django]-How to get Request.User in Django-Rest-Framework serializer?
2👍
import django
django.__file__
output will be given location of the django folder
'C:\\Users\\saigopi\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\django\\__init__.py'
- [Django]-Equivalent of PHP "echo something; exit();" with Python/Django?
- [Django]-Django Reverse with arguments '()' and keyword arguments '{}' not found
- [Django]-Django model blank=False does not work?
1👍
Worth mentioning that if you are using a virtual env all the packages will be in your project’s root venv folder under “lib” …
- [Django]-Login Page by using django forms
- [Django]-Jquery template tags conflict with Django template!
- [Django]-Sending an SMS to a Cellphone using Django
0👍
Try this on an terminal.
$ python -v
import django # directory /home/user/.virtualenvs/myenv/local/lib/python2.7/site-packages/django
# some other imports.
- [Django]-What is the Simplest Possible Payment Gateway to Implement? (using Django)
- [Django]-Creating a JSON response using Django and Python
- [Django]-Django: "projects" vs "apps"
-1👍
If you are using virtualenv then it will be:
/home/user/path where you installed django/django_directory/lib/python2.7/site-packages/Django-1.8.1-py2.7.egg/django/contrib/admin/templates/admin/base_site.html
base-site.html is the default template.
- [Django]-Choose test database?
- [Django]-Best practices for getting the most testing coverage with Django/Python?
- [Django]-Django in / not in query