Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python, flask, Django
#1
Hi
I posted before about a way of using python, via IIS, to give out html pages.
I was advised it is much better to use Flask, so I have been trying that.
I am however hitting restrictions that I cannot seem to find out solutions. Also I saw from job postings people like to have Django as well as or instead of Flask. So I have watched a video on DJango, which seems to be almost like Flask, but has a lot of stuff done automatically for you (the developer) which feels more like losing control. Plus its a lot more difficult to get going.
I am still going to read the Flask documentation to see whether it shines a light, but I wanted to ask whether it is worth persuing Flask/DJango, or try to recreate the logics via python pure/IIS to understand what happens under the hood.
It's mainly frustrating that I know what I want to do, but just cannot quite get it to work.
I have managed to get Flask to connect to mysql via sqlalchemy and retrieve data. So some success. But I am also aware I am building it wrong for py, forms, security. (Good as a test to say I have managed to do it - bad if I ever wanted to use it).
I also wanted to say thanks to those who have advised me here, you have been very helpful.
Reply
#2
Alright, let's backup and try to clear up some things which may have confused you.

IIS is a server. It would sit between your application and the end user. It doesn't matter if you use Flask or Django, they'll both communicate through fast cgi with IIS. Getting that bridge setup can be done through IIS' Web Platform installer: https://www.iis.net/downloads/microsoft/fastcgi-for-iis

There's also a python module which looks like helps with the config files (or maybe more, the module is published by Microsoft, so it isn't 3rd party, I just am not entirely sure what it does): https://pypi.org/project/wfastcgi/

Django and Flask serve the same purpose in your application. It doesn't make sense to use both at the same time. Your assessment that Django does more out of the box is correct, and along with that, it's much more difficult to customize if you don't like a particular aspect of it.
Reply
#3
Hi.
The first time I tried to use python, it was like using asp. Direct forward and returning html. This was advised to be an older way of processing, as I would need to add in all sorts of security checks. I set that up on iis using python as a handler mapping.
As i was advised to use flask, i installed that and followed a few different tutorials to run that after adding python to the path environment. These work up to a point.
After that I read about django. Which I havent installed yet. Just videos and comments.
I want intending to use both flask and django, just experiment with each to see which does what I would like. At the moment neither suit me. But I am sure I am missing something simple.
My main problem is that although I can read a db and output via template and capture data in a form, I cannot seem to fill said form with data already.
An example might be a registration form. To create a new record I think I can get that to work. But to edit it once it's there I cannot.
So I was just airing my frustration and thinking aloud whether it is worth building in the older style to get something I understand, or keep searching for a tutorial which can explain better how to do forms in flask or django.

Thank you for your response :)
Reply
#4
(May-02-2019, 01:22 PM)Ecniv Wrote: keep searching for a tutorial which can explain better how to do forms in flask
check this Flask tutorial
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
Thanks. I'll have a read through that.
Reply
#6
to pre-populate Flask-WTF form - https://stackoverflow.com/q/23712986/4046632
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python 3.7 on windows using flask and flask-sqlalchemy. Alpy 2 3,983 Aug-12-2020, 07:24 PM
Last Post: Alpy
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,296 Jun-30-2019, 12:21 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020