Ask Documentation
WebsiteGitHubPyPI
  • Introduction
  • Getting Started
    • Install & Get Started
    • Hello, World!
  • Routes & Requests
    • Routes
    • Defining Routes
    • Request Data
    • HTTP Status Codes & Methods
    • CORS
  • Response
    • JSON Response
    • JSON Response With an HTTP Status Code
  • Classes
    • Class Instance Variable
    • Initialization/Constructor Method
  • Data Types
    • Dictionaries
  • Built-in Utilities
    • Quick_set()
    • Deep()
    • Serialize()
    • Require_keys()
    • Random Generators
    • Pattern Matching
    • Email
  • Database
    • Ask and Databases
    • Models/Classes
      • Columns
      • Initialization/Constructor
      • Serialization
      • The &basic decorator
    • CRUD
      • Add
      • Select
      • Update
      • Delete
    • Check if a Row Exists
    • Sorting
    • Database Lists
  • JWT Authentication
    • Introduction
    • Protecting Routes
    • How to Create a Basic Login System
    • Properties & Methods of _auth
    • Making Requests to Protected Routes
  • Decorators
    • What are Decorators?
    • Create and Use Custom Decorators
    • Built-in Decorators
  • Security
    • Hashing
    • Route Security
    • Environment Variables
  • Configuring the Transpiler
  • Askfile.toml
  • Modules & Libraries
    • Importing an Ask Module
    • Includes
    • Importing Python Modules
  • Development Tools
    • Editor Syntax Highlighting
    • Automatic API documentation
    • CLI Flags
    • Running in development mode
    • Versioning System
  • Contribute
    • Feature Requests
    • Bug Reports
    • Contribute Code
Powered by GitBook
On this page
  • Syntax
  • Sections
  • DB
  • Rules
  • System
Export as PDF

Askfile.toml

Optional configuration options. Askfile.toml

The Askfile or Askfile.toml is a file that lives in the same folder as your app's source code file. The file allows you to configure different parts of your project and the Ask transpiler. Every project can have its own Askfile. The file is also optional, Ask automatically detects it if it's in the correct location.

Syntax

The file is a .toml file and is grouped by sections that contain rules.

Sections

DB

Path

  • String.

The path rule allows you to define a custom file name for the automatically generated SQLite database file. The default is db.db you could set this rule to e.g. '/database/my_db.db'.

[db]
path = 'database/my_db.db'

Custom

  • Boolean (true/false). Default is false.

This rule allows you to use an entirely different database than the automatically generated SQLite one. If you set this to true then the path rule can be used to point to e.g. a MySQL database.

[db]
custom = true
path = 'mysql://username:password@server/db'

Rules

Underscores

  • Boolean (true/false). Default is true.

This rule was introduced when Ask stopped enforcing the leading underscore syntax for built-in objects. E.g. previously you had to say: _auth.login() but now it's also possible to just say: auth.login() same goes for all other built-in words where a leading underscore was/is used. This rule allows you to enforce the backwards compatibility to be turned off. Right now it's still allowed to use both styles (even mixing them), so this rule allows you to turn that off.

[rules]
underscores = false

System

keep_app

  • Boolean.

Default is true. Set this to false if you want the output transpiled code file to be deleted once Ask quits. This is recommended when building non-web/API apps for example.

[system]
keep_app = false

server

  • Boolean.

Default is true. Set this to false if you don't want Ask to automatically start a web server once the transpilation is done. This is useful if you want to deploy the app in a more customized way.

[system]
server = false

output_path

  • String.

Kind of the same as the path rule for the database. This rule allows you to customize what the output file should be called and where it should be located. The default is the current working directory and with the file name app.py.

[system]
output_path = 'custom/my_app.py'
PreviousEnvironment VariablesNextImporting an Ask Module

Last updated 4 years ago