Giter Site home page Giter Site logo

lowerdeez / quest Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abrookins/quest

0.0 1.0 0.0 2.06 MB

Example app for the book The Temple of Django Database Performance, 2nd Edition

Home Page: https://spellbookpress.com

License: MIT License

JavaScript 21.91% Python 60.29% HTML 8.33% Dockerfile 0.20% Makefile 0.31% SCSS 8.96%

quest's Introduction

quest

This is the example code for the book The Temple of Django Database Performance by Andrew Brookins.

A Note on Versions

This code is for version 2 of the book, published August 2020. All buyers of the version 1 ebook (2019) have access to version 2 as a free download.

If you purchased the 2019 edition of the print book, this code is not substantially different than the code referenced in that book. However, this code includes a new example on using materialized views.

Setup

This project uses Docker to set up its environment, and it includes a Makefile to let you run docker-compose commands more easily.

Initial Setup

Run make build to build the images for the environment.

You'll also want to run docker-compose run web ./manage.py createsuperuser to create a superuser for yourself.

Dev Server

Run make dev to run Redis, Postgres, and the Django web application. The example's servers bind their ports to localhost, so you can visit the app at https://localhost:8000 once it's running.

Viewing Logs

Run docker-compose logs web to view logs for the web application. Likewise, 'postgres' and 'redis' will show logs for those servers.

Running Tests

Run make test to run the tests. Tests run in a container. If you drop in "import ipdb; ipdb.set_trace()" anywhere in the project code, you'll drop into a debugging session if the tests hit that code.

Generating Data for Performance Problems

Recreating many of the performance problems in this book requires a large amount of data in your database. This project includes a management command that will generate analytics events sufficient to cause performance problems.

Here's an example of using the management command to generate 500,000 analytics events for the user with ID 1 (in my case, this is my admin user):

$ docker-compose run web ./manage.py generate_events --num 500000 --user-id 1

Copyright

This example code is copyright 2020 Andrew Brookins.

quest's People

Contributors

abrookins avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.