DEV Community

Cover image for Setting Up Wagtail for Development on Windows: A Step-by-Step Guide
Chidera Stella Onumajuru
Chidera Stella Onumajuru

Posted on • Updated on

Setting Up Wagtail for Development on Windows: A Step-by-Step Guide

Hello! I'm currently an Outreachy applicant in the contribution stage. I'm a Django developer excited about Wagtail projects. In this article, I'll show you how to set up Wagtail on your Windows machine, sharing what I've learned so far.

Prerequisites
Before starting, make sure your Windows system has the following installed:

  • Git installed.
  • Python installed.
  • node version 18.0.0 installed.

Windows Subsystem for Linux(WSL) Installation Guide.

On your Windows machine, do the following;

  1. Open settings > apps> > optional features > more Windows features >.
  2. Enable WSL and reboot your system.
  3. Visit the Microsoft store. Install Ubuntu and follow the prompts, take note of the password requested as you will use it quite often.

Wagtail Installation Guide.

  1. Fork the repository by clicking on this link.

  2. From your Ubuntu terminal, create a directory and enter into that directory, create a virtual environment and activate it.

    mkdir wagtail && cd wagtail
    python3 -m venv venv
    source venv/bin/activate
    
  3. Copy the URL of your fork of the repository, just like I did in the picture below.

    Image showing how to copy the URL

  4. Clone your copy of the repository.

    git clone https://github.com/Chidera6/wagtail.git #[YOUR_FORKED_REPO_URL]
    cd wagtail
    
  5. Install the necessary dependencies.

    pip install -e ."[testing,docs]" -U
    
  6. Install the tool chain for building static assets and compile the assets.

    npm ci
    npm run build
    
  7. Run migrations for the test models using the code below.

    django-admin makemigrations --settings=wagtail.test.settings
    
  8. Start the server with the code below. You should see this file- ui_tests.db in /wagtail/test/, if everything went well.

    export DJANGO_SETTINGS_MODULE=wagtail.test.settings_ui
    ./wagtail/test/manage.py migrate #Create the tables.
    ./wagtail/test/manage.py createcachetable #create a cache table
    ./wagtail/test/manage.py runserver 0:8000 #starts the server
    
  9. In another terminal, and with your virtual environment activated, compile the UI component.

    npm run storybook
    
  10. Now, when you visit the URL http://localhost:8000 in your browser, you should see the output below indicating that the server is running successfully.

Image showing the output

Note

The official Wagtail documentation offers different setup guides based on your goals.
If this guide did not capture what you wanted, you could look it up for clarity.

Feedback and Corrections
I aim for accuracy in this guide. If you find any errors or have suggestions for improvement, please get in touch with me at onumajurubenedicta@gmail.com.

Conclusion
Congratulations! You've successfully enabled Wagtail for development on your Windows OS. Happy coding!

References
Wagtail documentation
Wagtail repository

Top comments (0)