[Answered ]-Import django models classes into utility module

2👍

If PythonFinal is in /home/users/jeremy/django/PythonFinal, then /home/users/jeremy/django should be in your PYTHONPATH environment variable, and DJANGO_SETTINGS_MODULE should be set to "PythonFinal.PythonFinal.settings". Then you can use

from PythonFinal.fertility.models import Cycle, Period

from the Python command line.

It is, however, more common to have the settings.py file in the same folder as manage.py, and a number of tools and tutorials expect this setup…

Leave a comment