Sunday, October 16, 2022

Re: Anyone help?

You can try ./manage.py shell

Then you can run:

from abcd.models import Person

On Mon, 17 Oct 2022 at 06:37, It's ShAdAn <shadanalvi08@gmail.com> wrote:


how i run model through manage.py

On Saturday, 15 October 2022 at 16:48:23 UTC-7 Thomas wrote:
You don't run model files directly, but rather through manage.py which references your settings.py file.

./manage.py

hth

- Tom

On Oct 15, 2022, at 1:07 PM, It's ShAdAn <shadan...@gmail.com> wrote:

  Got error


/usr/bin/python3.9 /home/user/PycharmProjects/pythonProject4/mycham/abcd/models.py
Traceback (most recent call last):
  File "/home/user/PycharmProjects/pythonProject4/mycham/abcd/models.py", line 4, in <module>
    class Person(models.Model):
  File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 108, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 253, in get_containing_app_config
    self.check_apps_ready()
  File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 135, in check_apps_ready
    settings.INSTALLED_APPS
  File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 63, in _setup
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Process finished with exit code 1



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/591dc7a3-2a13-4bc5-9ecb-b939a5688f34n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/db3bb2da-59a7-44c4-938a-d790e0a31c9cn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFKhtoT7AtZr76DfXoRhWAxxBMFvqsuSR-qdiqwv3SddZxWg1Q%40mail.gmail.com.

No comments:

Post a Comment