Oldschool Web Development for Humans™
Project description
index.py
Although I've never used PHP, I like its hot-swap mechanism. I expect to use index.py to make Python's Web program deployment easier.
Install
pip install -U index.py
Or get the latest version on Github
git clone https://github.com/abersheeran/index.py
sudo python3 setup.py install
How to use
Execute the command index-cli dev under the path where you place your Web program.
deploy
In linux, you can use index-cli gunicorn start to start server.
-
-w INT: The number of worker processes for handling requests. This value is best when it is equal to the number of cores of the CPU. -
-d: Increasing this parameter will cause the program to run in the background and redirect the log to thelog.indexin the current directory.
In windows......maybe you can use index-cli dev to deploy, but I don't think it's a good idea.
Configuration
The configuration allows the configuration to be automatically separated by ENV, and lowercase letters in all keys are automatically converted to uppercase.
You can use Config() anywhere in the program to use the configuration, which is a class that uses the singleton pattern. Like this
from index import Config
print(Config())
Environment variables
At startup, index automatically reads the configuration from the environment variable that begins with INDEX_.
like this
INDEX_DEBUG=on
INDEX_ENV=pro
Config file
At the root of your web program, the configuration in config.json will be read when index starts.
example:
{
"dev": {
"debug": true,
},
"pro": {
"debug": false,
"port": 34567,
"host": "0.0.0.0"
}
}
List
-
ENV
Default:
"dev"envis an important configuration that allows for the distinction between different configuration environments. -
DEBUG
Default:
FalseI don't think this needs explanation.
In the environment variable, INDEX_DEBUG is true when it is on or True, otherwise it is false.
-
LOG_LEVEL
Default:
"info"log_levelhas five values, the corresponding table to theloggingis as followslog_level loggins "critical" logging.CRITICAL "error" logging.ERROR "warning" logging.WARNING "info" logging.INFO "debug" logging.DEBUG -
HOST
Default:
"127.0.0.1"hostspecifies the bound HOST address. -
PORT
Default:
4190portpecifies the bound HOST port. -
ALLOWED_HOSTS
Default:
["*"]allowed_hostsallows you to restrict access to this application's host.Some examples:
-
["*"]
-
["example.com", "*example.com"]
-
["example.com", "test.com"]
-
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file index.py-0.1.1.tar.gz.
File metadata
- Download URL: index.py-0.1.1.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac5bcc0d26f38e7551541f06b6cedbf10fc410bb13554df3e0b4370b58c659d7
|
|
| MD5 |
7f99e5ff4b9c7e9b89438909771f8de6
|
|
| BLAKE2b-256 |
6319a5bc4494cd9f93e8916e7d4f070c0eb050fb03e3844706125d7af8d211a2
|
File details
Details for the file index.py-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: index.py-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
079380ae6d72f885e7a69027f837d077eaff07b1518bb10039d0f6bd972e4758
|
|
| MD5 |
dc4984e116ec9b2f038f8b1ce9c0e4d9
|
|
| BLAKE2b-256 |
db8dd4dde4a3af57fdd538504e6563ba959cbd3976225b46fe9459ca8ad94648
|