Webserver on python3
I've created a web app in Python 3. It all runs beautifully until I have to upload a file... There's n开发者_JAVA技巧o way to find the path or the file in the environment. I am using wsgi and I am thinking of migrating to another web server, what are your recommendations?
This is all what I receive from the
s = FileWrapper(environ.copy()['wsgi.input'])
for y in s:
print(y)
And the response of that is:
b'-----------------------------1514423166515917395188753897--\\r\\n'
What does this mean?
That's the file data, sent in a format guaranteed to survive to the destination, which is you. You need to decode it, and there are libraries for doing this in Python.
However, since you clearly don't know how these kinds of technical details work in the Web, if you want to write your own webserver you will have to learn. And it's not a trivial question.
I suggest you use some sort of web framework. There are tons of them for Python, I would recommend Pyramid or Django, both which now are ported to Python 3.
精彩评论