gig
gig

Reputation: 127

How do I create a web application using Core Python without a framework?

I want to build an web application using python as a backend so, as I did not learned any of the web frameworks that are available for python I want to know is there any way to create backend for an app without frameworks.

Upvotes: 0

Views: 971

Answers (2)

iliar
iliar

Reputation: 952

If it's something small for internal use you can use https://docs.python.org/3/library/http.server.html

Upvotes: 0

Arunmozhi
Arunmozhi

Reputation: 964

While there is a discussion in the comments about the utility of frameworks, I am trying to answer the question at its face value.

WSGI

Python frameworks like Flask and Django both at the end are WSGI applications. WSGI (Web Service Gateway Interface) is a PEP specification which defines how the server and client must communicate. If I were to start from scratch, I would probably start with learning about WSGI and even try implementing a little ping-pong server with it. The read the docs page here https://wsgi.readthedocs.io/en/latest/learn.html lists a number of pages to learn about it.

Werkzeug

Once the WSGI specs are understood then one can attempt building a simple library that will wrap the core concepts into reusable functions and modules for easily writing an application. Here Werkzeug can be a good guide to make one understand the different aspects. https://www.palletsprojects.com/p/werkzeug/

Your own application

Based on the understanding of the WSGI spec and the Werkzueg library you can go on to write your applications either from scratch, or write a library like werkzueg yourself and then use it to write an application.

Finally reimplement the same app in Flask or Django to see what frameworks offer.

Upvotes: 1

Related Questions