Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django settings in migrations

Tags:

python

django

Is it possible to access the Django settings from a migration? I'm attempting to load large data files (not fixtures within my project) into my database via a data migration. I would like the root directory of the data files to be configurable and the ability to read the path of the root directory from within my migration.

like image 771
jbritton Avatar asked Oct 18 '22 20:10

jbritton


1 Answers

in you migration file type:

from django.conf import settings

now you have access to your settings

like image 83
Dhia Avatar answered Oct 21 '22 16:10

Dhia