Where are Django registration redux defaut files stored - django

After I pip installed django-registration-redux, I want to modify its defaul froms.py, registration/registration/, but can not find that directory. And can not find the default files in any directory. Anyone know how to access those files thanks a lot!

You can check the file location of a python module (it could be pip installed) using .__file__. E.g.
>>> import registration
>>> registration.__file__
'/some/path/to/site-packages/registration/__init__.py'
This should help you locate where the module is physically located on your machine.
Pip installed package files are downloaded into the site-packages directory of your Python installation or virtualenv. You can use python itself to locate the directory:
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
With that being said, you should avoid modifying files in site-packages. Any changes you make are likely not tracked in version control. Consider either forking the project and installing directly from git, or download the source and add it to your project.

You can find it in the site-packages folder of your python installation. Hopefully you're using virualenv and then your in use python is in the lib folder from the virtualenv folder of your app.
Probably is not a good thing to modify the package itself. You can subclass any of the default forms or views in your project code and add fields, modify validation, etc.

Related

how to run a django project (made on linux) on windows?

I am new to programming and started working on Linux, now I want to switch to windows and open my project there, look at the tutorials, it is written to activate the virtual environment in the Settings / activate.bat folder. but in my project there is no such folder and such file with the extension .bat. what should I do?
Please download & Install interpreter from https://www.python.org/downloads/
(make sure you are using windows 10, because previous
version create problems)
Download pycharm professional addition (if you have university account) other wise go for community https://www.jetbrains.com/pycharm/download/
Click for Django project
Set the interpreter
Go to. manage.py task
Run command migrate
Enjoy
First thing get all the requirements like the library you installed through pip inside
a txt file by writing this command pip freeze > requirements.txt.
Get only the source folder where you made the project and app.
Create a folder.
Create an environment inside the folder. (virtualenv name_of_the_env)
Go inside the env you created and activate the Script. (.\Scripts\activate)
Copy the source folder inside the env and either you can install all the library
manually using pip or you can use requirement.txt that you have created to install the
library by writing this command pip install -r requirement.txt.
You need python and pip installed to work

Moving django app from virtualenv site-packages folder to projects root directory

New to django… i'm wondering if there is a way to move an app which i installed with pip in virtualenvs site-packages folder to my projects root directory.
I ask this because in my current case i'm using django-cms aldryn-blog and if i modify it's data in site-packages my changes wont be deployed because on server i install everything with pip from requirements. So i think the best would be to take the site-packages i want to modify to my project root directory because this way i wont forget about them when i deploy my site.
Is this clever and how could i do this?
Yes you can, an it is a normal thing to do. Just copy the folder from site-packages or download it directly on PyPI or GitHub. Don't forget to add the apps to the settings.
you could maybe just download it from github?
https://github.com/aldryn/aldryn-blog
And remove it from requirements of course, put it somewhere in your app directory or home directory and change the path in your INSTALLED_APPS accordingly
You can have it both ways:
Download the entire package to where it is most convenient for you to work on.
Install it in development/editable mode using pip install -e dirname (where dirname is the directory containing setup.py).
This will crete a .pth file in site-packages pointing to where you put your sources. You can do this in your requirements.txt file too (-e path/to/package).

how to include django templates in app installed via pip?

I'm working on a django app (django-flux) and I'm trying to get it to properly install with pip from pypi. From this blog post and the distutils documentation, it seems like my setup.py and MANIFEST.in files should be including the flux/templates/flux/*.html data files, for example, but they are not included when I install the app via pip for some reason.
Any suggestion on what I am doing wrong? How can you install django templates (among other non-python files)?
For reference, I have distutils 2.7.3.
You are missing include_package_data=True in your setup function.
For more information on this you could turn to Flask's excellent documentation which covers writing a Basic Setup Script:
include_package_data tells distribute to look for a MANIFEST.in file
and install all the entries that match as package data.
Then your are importing find_packages but aren't using it so far (packages = find_packages())

How to set the value of PATH variable in a virtualenv?

I have installed virtualenv and created a virtualenv directory for testing out the newer development version of django.I git cloned the latest version of django and placed .pth file inside the virtualenv's site package directory to the cloned django dir.Now I need to modify the PATH variable(to include django/bin) so that django-admin.py is accessible from the virtualenv.How can i do it?
My current PATH in virtualenv includes a directory
django/core/django/bin
Why does it include it ?
I haven't done any modification to PATH right now.
--I've given the relative path of the django directory here instead of the fullpath to mimnimize the clutter.
It's far easier to pip install using the repo itself. Then, all the linking is done for you automatically:
Just use:
$ pip install svn+http://code.djangoproject.com/svn/django/trunk/#egg=django
And, you're ready to roll.

Installing python packages in a custom dir

I installed "django-openid-auth" and it copied the egg to the django installation directory. I would like my installations to happen in a "plugins" directory within the django app. How would I do this? I checked options under python setup.py --help but couldn't find anything. Can I just copy everything from the site-packages folder into the plugins folder?
"Custom Installation"