Skip to content

Learn how to detect N+1 problems in Django app using AppSignal.

Notifications You must be signed in to change notification settings

duplxey/appsignal-django-n-plus-one

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

appsignal-django-n-plus-one

This repository contains the codebase for the article Find and Fix N+1 Queries in Django using AppSignal.

It is split into two branches:

  1. base -- serves as a starting point to follow the article
  2. master -- contains the final codebase after fixing the N+1 problems

Development Setup

  1. Fork/Clone

  2. Create and activate a virtual environment:

    $ python3 -m venv venv && source venv/bin/activate
  3. Install the requirements:

    (venv)$ pip install -r requirements.txt
  4. Apply the migrations:

    (venv)$ python manage.py migrate
  5. Populate the database:

    (venv)$ python manage.py populate_db
  6. Create a .env file with the following contents:

    APPSIGNAL_PUSH_API_KEY=<your_push_api_key>
  7. Run the server:

    (venv)$ python manage.py runserver
  8. Navigate to http://localhost:8000/ in your browser. N+1 problematic endpoints are:

    1. books/
    2. books/by-author
    3. admin/books/author/1/change/

Superuser

The superuser credentials after populating the database are:

user: admin
pass: password

About

Learn how to detect N+1 problems in Django app using AppSignal.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages