人财事物信息化 - Create an App

Create an App

Create a Frappe app scaffold using the bench CLI.

Create app

Before we start, make sure you're in a bench directory. To confirm, run bench find .:

bench find .

/home/fr/french is a bench directory!

To create our Library Management app, run the new-app command:

bench new-app library_management

You should get some prompts, and output like the following. You can enter information manually, or press enter to select the defaults


App Title [Library Management]: 
App Description: Library Management System
App Publisher: Qwert
App Email: qwert@feesow.com
App License (agpl-3.0, apache-2.0, bsd-2-clause, bsd-3-clause, bsl-1.0, cc0-1.0, epl-2.0, gpl-2.0, gpl-3.0, lgpl-2.1, mit, mpl-2.0, unlicense) [mit]: 
Create GitHub Workflow action for unittests [y/N]: y
Branch Name [develop]: 
'library_management' created at /home/fr/french/apps/library_management
Installing library_management
$ /home/fr/french/env/bin/python -m pip install --quiet --upgrade -e /home/fr/french/apps/library_management 
$ bench build --app library_management
✔ Application Assets Linked                                                                                                                           


yarn run v1.22.22
warning ../../package.json: No license field
$ node esbuild --production --apps library_management --run-build-command
File                                                        Size

 DONE  Total Build Time: 14.925s

Done in 35.17s.
Compiling translations for library_management

You will be prompted with details of your app, fill them up and an app named library_management will be created in the apps folder.

To see a complete list of all icons supported in the octicons library, check out https://primer.style/octicons/

App directory structure

Your app directory structure should look something like this:

apps/library_management
├── README.md
├── library_management
│   ├── hooks.py
│   ├── library_management
│ │ └── __init__.py
│ ├── modules.txt
│ ├── patches.txt
│ ├── public
│ │ ├── css
│ │ └── js
│ ├── templates
│ │ ├── __init__.py
│ │ ├── includes
│ │ └── pages
│ │ └── __init__.py
│ └── www
└── pyproject.toml


  • library_management: This directory will contain all the source code for your app

    • public: Store static files that will be served from Nginx in production
    • templates: Jinja templates used to render web views
    • www: Web pages that are served based on their directory path
    • library_management: Default Module bootstrapped with app
    • modules.txt: List of modules defined in the app
    • patches.txt: Patch entries for database migrations
    • hooks.py: Hooks used to extend or intercept standard functionality provided by the framework
    • pyproject.toml: Specifies how your app is built, you can optionally add 3rd party Python dependencies here which will get installed when your app is installed.

Next: Create a Site

Discard
Save
Review Changes ← Back to Content
Message Status Space Raised By Last update on