decouple

How do you use python-decouple to load a .env file outside the expected paths?

ε祈祈猫儿з 提交于 2019-12-21 04:17:27
问题 I'm forced to keep my .env file in a non-standard path outside the root of my project (in a separate directory altogether). Let's say I have my Django project in /var/projects/my_project , though I have my .env file in /opt/envs/my-project/.env where my SECRET_KEY is stored. In my settings.py file, I'd like to explicitly use the .env file at that path so that I can still do this: from decouple import config secret_key = config('SECRET_KEY') 回答1: I figured it out. Instead of importing decouple

How do you use python-decouple to load a .env file outside the expected paths?

谁都会走 提交于 2019-12-03 12:43:10
I'm forced to keep my .env file in a non-standard path outside the root of my project (in a separate directory altogether). Let's say I have my Django project in /var/projects/my_project , though I have my .env file in /opt/envs/my-project/.env where my SECRET_KEY is stored. In my settings.py file, I'd like to explicitly use the .env file at that path so that I can still do this: from decouple import config secret_key = config('SECRET_KEY') I figured it out. Instead of importing decouple.config and doing the usual config('FOOBAR') , create a new decouple.Config object using RepositoryEnv('

Entity classes decoupled from LINQ to SQL provider for implementing the Repository pattern. How?

谁说我不能喝 提交于 2019-12-02 19:42:07
I have looked over the Repository pattern and I recognized some ideas that I was using in the past which made me feel well. However now I would like to write an application that would use this pattern BUT I WOULD LIKE TO HAVE THE ENTITY CLASSES DECOUPLED from the repository provider. I would create several assemblies : an "Interfaces" assembly which would host common interfaces including the IRepository interface an "Entities" assembly which would host the entity classes such as Product, User, Order and so on. This assembly would be referenced by the "Interfaces" assembly since some methods