N
N
naneri2013-11-23 09:35:37
Python
naneri, 2013-11-23 09:35:37

Where to start learning web development in Python, for a person who is completely unfamiliar with the backend?

I recently completed a Python course at Codecademy. But the course does not teach web development.
I myself studied HTML, CSS, JS as well as Jquery (on the same codecademy) and Bootstrap (on youtube).
I downloaded google app engine, but I'm not sure that learning web development will go faster with it.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
Masterme, 2013-11-23
@naneri

Working with the web differs from working with non-web in one simple thing:
- the server (Apache, Njinx, etc.) receives a request (and the request is a string) from the browser,
- the server accesses the application, passing this string as an argument to it ,
- the application returns the result (also a string),
- the server sends the received string to the browser.
Specifically for python, such connection of the script to the web server is solved using WSGI .
How to do it. In the web server settings, you specify the document_root of your application and the script with the callback. Apache config:

<VirtualHost *:80>
     ServerName mysite
     DocumentRoot /var/sites/mysite/public
     WSGIScriptAlias / /var/sites/mysite/script.wsgi
 </VirtualHost>

A callback is a function in the global namespace, always called application. It looks something like this:
def application(environ, start_response):
    status = '200 OK' 
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

When Apache receives a request, it will launch the application function via wsgi, and return the result received from it in response to the request.
That's all it takes to understand how to process http requests from python. All jungs work on the same mechanism.
Now an unobvious nuance. The matter is that usually the Apache in a normal condition gives a statics as a statics. And if you connect wsgi to it, then wsgi will start intercepting requests to statics too. In django, this situation is solved through the ass (which proves that djangodrochers are alternative-thinking), namely: it is proposed to create a subdomain for static and distribute it with a server without wsgi, some kind of nginix, or give the static with a script. Both options are, to put it mildly, controversial. I think the third option is much better and more flexible:
<VirtualHost *:80>
     ServerName mysite
     DocumentRoot /var/sites/mysite/public
     RewriteEngine on
     RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
     RewriteRule (.*) /index.py/$1 [L,QSA,PT]
     WSGIScriptAlias /index.py /var/sites/mysite/script.wsgi
  </VirtualHost>

(Discussed here .)

H
Heckfi, 2013-11-23
@Heckfi

try learning some python framework (django, flask)

A
Alexander Bizikov, 2013-11-23
@bizikov

It's better to start with Django. There is a good Django book on the subject. Detailed guide

A
Ali Aliyev, 2013-11-23
@ali_aliev

It is worth starting with this book http://www.ozon.ru/context/detail/id/5730448/
Further http://www.ozon.ru/context/detail/id/8382738/ and http://www.ozon .ru/context/detail/id/8382719/
The first volume on the basics of the language, the subtleties of python are very well described. The two volumes talk about developing web applications, GUI, multithreading in Python. Then just read the Django documentation, there you can say a whole book and everything is described in great detail. I also advise you to read this book https://django.2scoops.org/

M
maharuga, 2016-12-11
@maharuga

Here is a good Python book: Building Applications
and More Developing Geo-Apps with Python

A
Arthur, 2013-12-29
@ArthurG

I have little experience in python programming under Google App Engine (AE). I'll just describe how I learned.
At first, I myself tried to read and understand the AE documentation for a long time. I didn’t have enough knowledge of python, or rather, I wasn’t sure that I could write. Then came courses from udacity.
First I took a course in Python. The course is in English, but because everything is visualized, then everything is clear with minimal knowledge. Then I took a course in web programming there. I learned the basic concepts and that was enough.
Now about AE specific knowledge, they can be obtained from the documentation (in English) and videos from conferences, there are not many of them and they are very informative. For example, how to build a data model on a datastore.
Everyone here strongly advises Django, but I have never had a moment when I lacked the functionality of webapp2, which was made by Google. In general, you decide.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question