Ben django heroku öğretici takip ediyorum. Ben 'config vars' tanımladım. Ben .env dosyası oluşturduk benim views.pydjango .env dosyası öğretici gibi çalışmıyor
import os
ithal ve böylece
def index(request):
times = int(os.environ.get('TIMES',3))
return HttpResponse('Hello! ' * times)
gibi modifiye ettik
python-getting-started\
getting-started\
hello\
.env
öğretici
heroku local will automatically set up the environment based on
the contents of the .env file in your local directory.
Edit the .env file to add:TIMES=2
If you run the app with heroku local, you’ll see two “Hello!”’s.
diyor
Değiştirdikten sonra üç kez hala 'Merhaba' görüyorum. Yerel sunucuyu üç kez yeniden başlattım ama çalışmadı. Bunu işe almak istiyorum, bu yüzden değişken olması gereken tüm kodlanmış şeyleri kaldırabilirim, bu yüzden uygulamanız güvende. Neyi kaçırıyorum? Tüm rehberlik açıktır.