Skip to main content

Write professional web interface with Python

Project description

Python AdminUI

Full Readme at Github Documentation 中文文档

Write professional web interface with Python.

If you need a simple web interface and you don't want to mess around with HTML, CSS, React, Angular, Webpack or other fancy Javascript frontend stuff, this project is for you. Now you can write web pages, forms, charts and dashboards with only Python.

This library is good for: data projects, tools and scripts, small IT systems and management systems, Hacker or Hackathon projects. Basically if you need an interface for your system and you don't care much about customizing the style or performance for large traffic, consider this package.

This project is based on Flask/FastApi and Ant Design Pro.

Screen Shot

Features

  • No HTML, CSS, JS needed
  • Database agnostic: feed content at your own, no matter it's MySql, Sqlite, Excel tables, Firebase or some IoT hardware
  • JWT based authentication/login system with a neat login page
  • Forms and detail pages
  • Line and Bar Chart
  • Create decent looking menus
  • Data tables with pagination
  • Adaptive to small screens and mobile devices
  • Support both Flask and FastApi

Installation and quick start

install the package with pip:

pip install adminui

The basic "form page" example:

# example_form.py
from adminui import *

app = AdminApp()

def on_submit(form_data):
    print(form_data)

@app.page('/', 'form')
def form_page():
    return [
        Form(on_submit = on_submit, content = [
            TextField('Title', required_message="The title is required!"),
            TextArea('Description'),
            FormActions(content = [
                SubmitButton('Submit')
            ])
        ])
    ]

if __name__ == '__main__':
    app.run()

Run the Python file:

python example_form.py

Then visit http://127.0.0.1:5000/ to see the result.

Use FastApi instead of Flask

Set use_fastapi=True when creating the app; and prepare() instead of run() to expose the app to uvicorn. See python/example_fastapi.py for details

# instead of app = AdminApp(), use
app = AdminApp(use_fastapi=True)

# ... other stuff you do with adminui app

# in the end of the main file, use
fastapi_app = app.prepare()

# in command line, run:
# uvicorn example_fastapi:fastapi_app

Documentation

Hosted on Read the Docs

Contributing and Development

This is a personal project. So please create issues to tell me what you need from this project.

You may also give stars to let me know if this project is worthy to invest more time on.

To work with the source code:

This project has a Typescript front-end and a Python backend.
The front-end is in the /src folder.
The back-end is in the /python folder.
To start developing:

  • cd into /python folder and run pip install -r requirements.txt to install requirements
  • run one of the example_xxx.py file in the /python folder
  • Open another terminal, run npm install & npm start at the root folder to start the frontend;

Under this development mode, requests from front-end will forward to the backend.

When you are done with developing:

  • run npm run build will build the project.

The front-end is based on the amazing Ant Design Pro library, you may consult their documentation during the development.

The Python backend is located in /python/adminui. It is Flask based. There are some examples in the /python folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adminui-1.4.0.tar.gz (928.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adminui-1.4.0-py3-none-any.whl (12.5 MB view details)

Uploaded Python 3

File details

Details for the file adminui-1.4.0.tar.gz.

File metadata

  • Download URL: adminui-1.4.0.tar.gz
  • Upload date:
  • Size: 928.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for adminui-1.4.0.tar.gz
Algorithm Hash digest
SHA256 131133d9b3a52caf19c958ab4768704c9227b8a9fa9b1d3fb241b86bfce3e7d5
MD5 13db933258c45425795c40fe1dc4b719
BLAKE2b-256 95b96cf15ca51fc8d77384201e9c92a082f6e4344f53d6f5277e0a7aa63136ca

See more details on using hashes here.

File details

Details for the file adminui-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: adminui-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for adminui-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43ed3dd23b355d7d1e54e1371ff8c7a1278ed81b96dc8bce83102b7c28b59426
MD5 5b0c41589df648478970f8bd1555e64b
BLAKE2b-256 6f8ef874418dc86ef7b6f886d0130722d0df52cec5989cf7be9fa5ded9b2f006

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page