I have a Django project and I wanted to generate some objects (from the models)
What I'm trying to get at : Standalone Python Script to create bunch of objects and/or filter,delete.
after importing the model with from apps.base.models import MyModel
and setting up the configuration as the previous StackOverflow Questions suggested I was not able to run the script.
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myProject.settings")
import django
django.setup()
from apps.base.models import MyModel
Please note that this is on Django version 2.0.6 [Django 2.0+].
Correct settings have been used, (i.e. myProject.settings
)
After properly configuring everything else I get the following error:
RuntimeError: Model class apps.base.models.MyModel doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Settings:
base.py : https://pastebin.com/MNcitE4U
development.py : https://pastebin.com/JAHqxwRM
The full GitHub link is here: https://github.com/teratzu/Razred-Management