Answer the question
In order to leave comments, you need to log in
How to import models from a Django application into a program?
There is a project bot app in Django.
In the working folder of the project there is also a run.py file.
Django project launched in production via gunicorn
How to import models from a Bot application from run.py?
Answer the question
In order to leave comments, you need to log in
import sys
import django
import project.settings as DjangoSettings
sys.path.append('path_to_project')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
django.setup()
from Bot import models
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question