0

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.

10
  • 4
    It's much simpler to simply learn a framework like Django or Flask than to attempt to make one yourself using the standard library tools like urllib - thousands of hours have been put into making those tools so that you don't have to figure everything out from scratch and reinvent the wheel. Is there a particular reason you're averse to using frameworks other than "not wanting to learn them"? Commented Nov 23, 2019 at 6:04
  • Yes, I want to be strong in basics too... Commented Nov 23, 2019 at 6:09
  • 1
    You're probably better off reading the source code for existing frameworks before trying to write your own (and don't write your own. big waste of time) Commented Nov 23, 2019 at 6:14
  • 1
    I guest your request is about a learning purpose. Yes, you can code your backend in purely python without using a framework. How to do it ? You have to check it through Python documentation or a search engine... Commented Nov 23, 2019 at 6:39
  • 1
    YES, it is possible. You can achieve your goal. Now, you need to have a basic knowledge of the frontend tols (html, css and perhaps javascript if you want). In the backend, you will use python and surely a database (mariadb, mysql or sqlite should be nice). How to use python in the backend to build a web app? You have to check it. Commented Nov 23, 2019 at 6:54

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.