Django [WinError 5] IIS

时间:2017-07-24 10:21:37

标签: python django windows iis urlopen

我在Windows IIS上遇到Django 1.11的问题。在localhost上它可以工作,但在IIS上没有。有什么想法吗?

错误[WinError 5]拒绝访问 http://www.wklej.org/id/3223563/

views.py

from django.shortcuts import render
from django.utils import timezone
from . models import Order

import sqlite3
import time
import datetime

import xml.etree.ElementTree as et
import urllib.request as ur

def get_order(request):
web_data = ur.urlopen('http://www.xxxx.com/pl/pl/xml/index/id/xxxx/password/xxxxx/no_tagging/1')
str_data = web_data.read()
xml_data = et.fromstring(str_data)
order_list = xml_data.findall("order")
conn = sqlite3.connect('db.sqlite3')
c = conn.cursor()
for order in order_list:
    order_id = order.find("bestellungid").text
    add_date = order.find("datum").text
    amount = order.find("anzahl").text
    price = order.find("a_preis_a").text
    desc = order.find("a_bezeichnung1").text
    sap = order.find("a_int_artikelid").text
    customer_name = order.find("h_name1").text
    customer_street = order.find("h_anschrift").text
    customer_code = order.find("h_plz").text
    customer_city = order.find("h_ort").text
    customer_phone = order.find("h_telefon").text
    payment = 'Pobranie'
    status = 'Nie zrealizowane'

    c.execute("INSERT OR IGNORE INTO tyre24_order (order_id, add_date, amount, price, desc, sap, customer_name, customer_street, customer_code, customer_city, customer_phone, payment, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (order_id, add_date, amount, price, desc, sap, customer_name, customer_street, customer_code, customer_city, customer_phone, payment, status))

conn.commit()
c.close()
conn.close()
return render(request, 'get_tyre.html')

0 个答案:

没有答案