This guide outlines the steps to set up a development environment using Frappe Docker, which will enable you to develop and debug Frappe and Frappe-based applications efficiently.
Prerequisites
Ensure you have the following installed on your system:
- Docker: A containerization platform.
- Docker Compose: A tool for defining and running multi-container Docker applications.
- Git: A version control system.
- Visual Studio Code (VSCode): A source-code editor that supports the DevContainer extension.
Setup Instructions
Clone the Repository
Start by cloning the frappe_docker
repository and navigate into the directory:
git clone https://github.com/frappe/frappe_docker.git
cd frappe_docker
Configure Development Container
Copy the example development container configuration:
cp -R devcontainer-example .devcontainer
Copy the VSCode configuration for the development container to set up basic debugging capabilities:
cp -R development/vscode-example development/.vscode
Open in VSCode
Open the project in VSCode. If the Remote Containers extension is installed, you should see a prompt to reopen the project in a container. If not, reload the window or press Ctrl + Shift + P
, then search for and select "Rebuild and Reopen in Container".
Modify Application Configuration
Edit apps-example.json
to point to the correct repository and branch for your application:
[
{
"url": "https://{{PAT}}@github.com/example/your_private_repo.git",
"branch": "main" // can change according
}
]
Replace {{PAT}}
with your GitHub Personal Access Token (PAT).
Reference Link : https://docs.github.com/en/enterprise-server@3.9/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
Install Dependencies and Setup Application
Run the Python installer script with the appropriate repository and tag:
python installer.py -r {{your_forked_frappe_repo}} -t {{forked_repo_branch_name}} -p {{python-version}}
Reference Link : https://github.com/frappe/frappe_docker/blob/main/docs/development.md
Activate the Python virtual environment:
source env/bin/activate
Navigate to the application directory, and install the required Python packages:
cd apps/{{you_app_name}}/
pip install -r requirements.txt
Set the default site in Bench:
bench use development.localhost
Start the Development Server
Navigate back to the frappe-bench
directory and start the development server using either of the following commands:
cd ../frappe-bench
bench start
or
honcho start web socketio watch schedule worker
Conclusion
Following these steps will set up your Frappe Docker development environment, allowing you to develop and debug applications within a containerized environment seamlessly.
Top comments (0)