Skip to main content


Project description


ahserver is a http(s) server base on aiohttp asynchronous framework.

ahserver capabilities:

  • user authorization and authentication support
  • https support
  • processor for registed file type
  • pre-defined variables and function can be called by processors
  • multiple database connection and connection pool
  • a easy way to wrap SQL
  • configure data from json file stored at ./conf/config.json
  • upload file auto save under config.filesroot folder
  • i18n support
  • processors include:
    • 'dspy' file subffix by '.dspy', is process as a python script
    • 'tmpl' files subffix by '.tmpl', is process as a template
    • 'md' files subffix by '.md', is process as a markdown file
    • 'xlsxds' files subffix by '.xlsxds' is process as a data source from xlsx file
    • 'sqlds' files subffixed by '.sqlds' is process as a data source from database via a sql command


see requirements.txt



How to use


from ahserver.configuredServer import ConfiguredServer

if __name__ == '__main__':
	server = ConfiguredServer()

Folder structure

  • app
  • |
  • |--ahserver
  • |-conf
  •  |-config.json
  • |-i18n

Configuration file content

ahserver using json file format in its configuration, the following is a sample:


database configuration

the ahserver using packages for database engines are:

  • oracle:cx_Oracle
  • mysql:mysql-connector
  • postgresql:psycopg2
  • sql server:pymssql

however, you can change it, but must change the "driver" value the the package name in the database connection definition.

in the databases section in config.json, you can define one or more database connection, and also, it support many database engine, just as ORACLE,mysql,postgreSQL. define a database connnect you need follow the following json format.

  • mysql or mariadb

the dbname and "db" should the same, which is the database name in mysql database

  • Oracle
  • SQL Server
  • PostgreSQL

https support

In config.json file, need to set(see above)

website configuration


ahserver can serve its contents (static file, dynamic contents render by its processors) resided on difference folders on the server file system. ahserver finds a content identified by http url in order the of the paths specified by "paths" lists inside "website" definition of config.json file


all the prcessors ahserver using, must be listed here.


by defaualt, ''


by default, 8080


ahserver recomments using 'utf-8'


the browsers will send 'Accept-Language' are difference even if the same language. so ahserver using a "langMapping" definition to mapping multiple browser lang to same i18n file


ahserver using MiniI18N in appPublic modules in pyutils package to implements i18n support

it will search translate text in ms* txt file in folder named by language name inside i18n folder in workdir folder, workdir is the folder where the ahserver program resided or identified by command line paraments.


To be list here

environment for processors

When coding in processors, ahserver provide some environment stuff for build apllication, there are modules, functions, classes and variables


  • time
  • datetime
  • random
  • json


  • configValue
  • isNone
  • int
  • str
  • float
  • type
  • str2date
  • str2datetime
  • curDatetime
  • uuid
  • runSQL
  • runSQLPaging
  • runSQLIterator
  • runSQLResultFields
  • getTables
  • getTableFields
  • getTablePrimaryKey
  • getTableForignKeys
  • folderInfo
  • abspath
  • request2ns
  • CRUD
  • data2xlsx
  • xlsxdata
  • openfile
  • i18n
  • i18nDict
  • absurl
  • abspath
  • request2ns


  • resource
  • terminalType


  • ArgsConvert

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

ahserver-0.3.4.tar.gz (21.1 kB view hashes)

Uploaded Source

Supported by

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