How Django uses relative paths in configuration
This article mainly introduces how to use the relative path in the configuration of Django, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.
Use relative paths in configuration
For some reason, projects may often be moved back and forth. This is definitely a thorny problem if this possibility is not planned in advance. Rob Hudson has an excellent technique to ensure that your Django project can be easily migrated back and forth during deployment. Just write a few lines of code in your settings.py.
Import osBASE_DIR = os.path.dirname (os.path.abspath (_ file__)) TEMPLATE_DIRS = (BASE_DIR +'/ templates',) Thank you for reading this article carefully. I hope the article "how to use relative paths in Django configuration" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!