K
K
Kirill Petrov2018-08-10 00:08:20
Django
Kirill Petrov, 2018-08-10 00:08:20

Ways to integrate a pythone parser and a Django project, how to combine?

How to merge parser and django project? I tried to create instances of the class, but I can't import the models normally. Imported, they are imported, but a lot of errors are produced, eliminating which it still returns to the first one. I think to make it easier: create a new database and bind the issuance of posts to it (parsing will go into it, the parser in the database works fine), and leave the rest of the functionality to the standard database. Are there any other alternative ways and where can I see their implementation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexey_korotynski, 2018-08-10
@alexey_korotynski

in the parser you need to write

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "путь_до_settings_файла")
django.setup()

after that, you can import models from the Django project.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question