I'm trying to pull stripe settings from my cookiecutter base.py, and it's not working. I'm not sure if I have not set my view correctly, or what.
I'm testing all of this locally, and I have installed stripe via pip and added it to my installed apps (not sure if I needed to do that)
here is my urls.py for the payment view
path("payment/", TemplateView.as_view(template_name="pages/Payment.html"), name="payment")
And here is my views.py
class PaymentView(TemplateView):
template_name = 'Payment.html'
def get_context_data(self, **kwargs): # new
context = super().get_context_data(**kwargs)
context['key'] = settings.STRIPE_PUBLISHABLE_KEY
return context
I've got the following in my base.py
STRIPE_SECRET_KEY = 'sk_test_xxxx'
STRIPE_PUBLISHABLE_KEY = 'pk_test_xxxxx'
I feel my issue isn't that I have the keys in the wrong place. I may just have my view class not named correctly. Any help? Thanks!
Your url is a generic TemplateView
which renders the template specified.
To use your custom view you have to specify it in the url
path("payment/", PaymentView.as_view(), ...