我想在heroku上为我的付款处理部署dj-stripe。
1)我创建了项目付款
2)我已经安装了dj-stripe,在INSTALLED_APPS中,我已经包含了' djstripe'。
3)接下来,我已经包含了urlpattern
localhost:5000/accounts/login/?next=/stripe/
4)现在,当我转到Using the URLconf defined in payment.urls, Django tried these URL patterns, in this order:
^admin/
^stripe/
The current URL, accounts/login/, didn't match any of these.
时,它会重定向到STRIPE_PUBLIC_KEY = os.environ.get("STRIPE_PUBLIC_KEY", "<your publishable key>")
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "<your secret key>")
and
DJSTRIPE_PLANS = {
"monthly": {
"stripe_plan_id": "pro-monthly",
"name": "Web App Pro ($25/month)",
"description": "The monthly subscription plan to WebApp",
"price": 2500, # $25.00
"currency": "usd",
"interval": "month"
},
"yearly": {
"stripe_plan_id": "pro-yearly",
"name": "Web App Pro ($199/year)",
"description": "The annual subscription plan to WebApp",
"price": 19900, # $199.00
"currency": "usd",
"interval": "year"
}
}
并将此错误传达给我
python manage.py migrate
python manage.py djstripe_init_customers
python manage.py djstripe_init_plans
修改
根据文档,我已将这些添加到我的项目的settings.py
中function CopyPaste(e) {
var activeSheet = e.source.getActiveSheet();
var CIP = SpreadsheetApp.openById('12y5scoiksxow09DkW4bXH2YMQLCp_KHBfNFoju3IezA'); //target spreadsheet
var channels = [49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58]; //Columns to check where the X was ticked
var ind = channels.indexOf(e.range.columnStart);//Change column numbers to index
if (activeSheet.getName() !== 'HL' && activeSheet.getName() !== 'HA' && activeSheet.getName() !== 'AU' || ind == -1 || e.value !== 'X') {
function showAlert() {
var ui = SpreadsheetApp.getUi();
var result = ui.alert(
'Please confirm',
'Are you sure you want to continue?',
ui.ButtonSet.YES_NO);
}
}
if (result == ui.Button.YES) {
// User clicked "Yes".
return;
var target = CIP.getSheetByName('Suggestions'); //Makes the output sheet = t
var lr = target.getLastRow() < 4 ? 4 : target.getLastRow() + 1; //Should it start on Row 4 or on the last row
Logger.log(lr); // Log road
var RequiredData = activeSheet.getRange(e.range.rowStart, 1, 1, activeSheet.getLastColumn())
.getValues()[0]
Logger.log(RequiredData);
target.getRange(lr, 1, 1, RequiredData.length).setValues([RequiredData])
Logger.log('done');
ui.alert('Confirmation received.');
} else {
ui.alert('Permission denied.');
}
}
最后我运行了这些命令
undefined
答案 0 :(得分:0)
根据dj-stripe docs,添加到 urls.py :
url(r'^payments/', include('djstripe.urls', namespace="djstripe")),
添加到您的配置:
STRIPE_PUBLIC_KEY = os.environ.get("STRIPE_PUBLIC_KEY", "<your publishable key>")
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "<your secret key>")
和
DJSTRIPE_PLANS = {
"monthly": {
"stripe_plan_id": "pro-monthly",
"name": "Web App Pro ($25/month)",
"description": "The monthly subscription plan to WebApp",
"price": 2500, # $25.00
"currency": "usd",
"interval": "month"
},
"yearly": {
"stripe_plan_id": "pro-yearly",
"name": "Web App Pro ($199/year)",
"description": "The annual subscription plan to WebApp",
"price": 19900, # $199.00
"currency": "usd",
"interval": "year"
}
}
然后运行命令
python manage.py migrate
python manage.py djstripe_init_customers
python manage.py djstripe_init_plans
答案 1 :(得分:0)
我解决了这个问题!
问题是我还没有创建超级用户帐户。我包含了管理包并创建了超级用户帐户。这解决了这个问题:)