Answer the question
In order to leave comments, you need to log in
Python. How to study?
Hello. I want to start writing scripts in python, as I did in PHP. What is needed for this? At the moment I know primitive syntax, a couple of python functions. Installed a bunch of nginx + uwsgi + python3. Launched a simple hello world. Actually knowledge is very lacking, I want to choose a course. What books to read? Russian is desirable to be explained in detail.
In Php, everything is much simpler. I have index.php and do whatever I want there, but in python for a simple hello world you need to use
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')] )
return [b"Hello World"]
;)
Ok, the header is passed here. I understand that the web in python already works with a shell (like a framework), but I want to have more knowledge. And why does the server need to be restarted every time?
Answer the question
In order to leave comments, you need to log in
And why does the server need to be restarted every time?
$ mkvirtualenv test-django
(test-django)$ pip install django
(test-django)$ django-admin startproject testdjango
(test-django)$ python manage.py runserver
$ mkvirtualenv test-flask
(test-flask)$ pip install Flask
(test-flask)$ echo 'from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()'>hello.py
(test-flask)$ python hello.py
Stupidly take the task and solve it. Google, look in books, ask on forums. After half a year, look at your code, go nuts and write again, this time it's better :) You can see the list of tasks here for example.
If you are interested in web development, start right away with some framework, Django, for example. You can start learning from the documentation on her website, there are excellent examples.
If the language itself is interesting, then it is easier to run scripts directly from the console and experiment with the structure of the language, and only then deal with the web.
During my language learning days, Beginning Python - From Novice To Professional (2005) was a good book.
Get a python and learn. Learn-learn learn-learn ras-ras-ras ras-ras-ras ras-ras-ras.
and with examples of programs (including on performance) is? otherwise Lutz has a dry theory, like documentation.
In order not to fence what you had to fence, use Django (or some other web framework, there are many of them).
I would suggest doing this: learn the basics of Python first, without touching the web, and go to the basics of OOP in Python. After that, install Django and dig into it already.
tasks can be taken here . and you need to pass the theory as part of the first year of the university - this is for any language in principle
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question