Flask Tutorial Web Development with Python 2 - Basic site setup

preview_player
Показать описание
In this second part to our practical Flask with Python web development video series, we cover the setting up of a very basic website.

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

I've been struggling for hours, wondering why didn't work for me. Then I realize that maybe WSGI doesn't know about my virtual environment. I had to install flask outside my virtual environment (pip install flask)...

lllForneronlll
Автор

This ip is now assigned to a church management service

OPOD
Автор

"If you understand WSGI then congratulations."
I lol'd.
Thanks for that.
I don't get it either...but that made me feel much better about it.

Achooification
Автор

The initial setup is much complicated than a django webapp

mfsc-
Автор

Hi Harrison, first thank you so much for your tutorials, you are a great teacher.

I have a problem with (maybe) Flask, I've followed your tutorial step by step but at the end, the ubuntu apache2 default page "it works!" shows up instead of the __init__.py I would expect.
I cannot find the solution over the internet to solve that problem. Do you have any idea why?

foenixlord
Автор

Hi sentdex, I can't seem to find the 'basic' tutorial that you talk about in this video on pythonprogramming.net? Can someone link to that please? Looking to set up a local server and want to check that out. Thanks

coenraadmiddel
Автор

by the way, i have python 2 built in, and installed python3 myself. " apt-get install python3-pip" works, but not "pip install flask" because it will install flask to python 2 as a default. if you have the same problem, try " pip3 install flask" this should work.

alan
Автор

Thanks for the awesome tutorial. I followed each and every step. But I get 404 Not Found when I navigate to the ipaddress. Why would that happen? Running python __init__.py on ssh runs correctly.

selvaprasanna
Автор

heads up to anyone using python3, make sure you install wsgi-py3:
sudo apt-get install libapache2-mod-wsgi-py3

TNazz
Автор

Like others I ran into the situation where Apache wouldn't work with the virtual environment.

From /var/log/apache2/error_log you'll see something along the lines of "ImportError: No module named flask"

I followed some instructions for Django at


In short, to fix:

1. Edit
2. Add the following two lines before the "WSGIScriptAlias" line:
WSGIDaemonProcess FlaskApp
WSGIProcessGroup FlaskApp
3. Restart Apache with "service apache2 restart"

It should work now.

nategmail
Автор

I am still getting server 500 error after installing Flask 3 out site virtual env .Any suggestion?

saketmehrotra
Автор

hey sentdex can u please help me with this asap. I have followed ur guide multiple times with no luck. I copy exactly what you do and every time i try and load my site it just loads the apache default

exitexitexitexit
Автор

lol, the tutorial in this video and the tutorial on your website seem completely different.

volundros
Автор

even if I followed everyting as you did, I can`t have any reaction when typing service apache2 restart and service apache2 reload. can you help me out??

SeonghyeonKim-mlgr
Автор

For those who are running into the Apache issue related with the virtual environments:

There is a solution in the Flask website actually explaining what to do in the case of working with virtual environments,

Add the following lines to the top of your .wsgi file:

activate_this =
execfile(activate_this, dict(__file__=activate_this))

This is the official solution for this problem. Installing flask outside of your virtual environment is a workaround in this case.

bckahraman
Автор

At the end of the tutorials where we start the server


it just hangs and does nothing, any ideas why?

visethsen
Автор

Hey Bud this is great But For the Life of me I can not get it to work with a virtual enviroment, would you mind showing us, Thanks

tamato
Автор

Everything is done on gnu/linux machines! Really why you guys use Windows to develop?

vapon
Автор

welp don't follow this tutorial and the one on the website at the same time

joftenly
Автор

Your video is completely different from the commands/walk through on your website.... the video is shown before the blog post.

Like sadly things are broken and following line by line is not working. Since things are broken along the way. Had to reach out to other blogs and use the interwebs just to get a simple __init__.py working with wsgi and everything.

mvrk
visit shbcf.ru