Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

django-abtoast

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-abtoast

ABToast is an A/B Testing app that is developed in django.

  • 1.2.0
  • PyPI
  • Socket score

Maintainers
1

ABToast

ABToast is a simple A/B Testing app that is developed in django. This app implements the Django Session functionality to achieve the goal.

Installation

ABToast requires Django to run.

Install ABToast from pip

$ pip install django-abtoast

OR, Get ABToast locally

$ git clone https://github.com/htadg/ABToast.git ABToast

Add ABToast to INSTALLED_APPS

INSTALLED_APPS = (
    # Django Default Apps
    'django.contrib.admin',
    '...',
    # ABToast
    'ABToast',
)

Add ABToast.middleware.ABMiddleware to the project middlewares

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    '...',
    # Custom Middleware
    'ABToast.middleware.ABMiddleware',
)

Migrate the database and create admin account

$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py createsuperuser

Now Create your own new Tests in the Database

Note: You can also create New Experiment and Tests from the Django Admin Panel
from datetime import datetime
from dateutil.relativedelta import relativedelta

from ABToast.models import Experiment, Test


# Starting the Experiment from today
start_date = datetime.now()
# End Date for the Experiment
# Experiment runs for two months
end_date = start_date + relativedelta(months=+2)

# Initial Traffic Redirect for the first variant
initial_traffic = 50 # 50%

# Create an Experiment
exp = Experiment.objects.create(name="Homepage Test", template_name="registrations/signup.html", goal="registrations/success", start=start_date, end=end_date, is_active=True)

# Create two variations of the homepage.
# Currently User can only create two Test instances for a particular Experiment
# which means currently user can run A/B Testing on only two variants of a Page
# One Test for the original template
Test.objects.create(template_name="registrations/signup.html", experiment=exp)

# Other Test for the New Variant
Test.objects.create(template_name="registrations/new_signup.html", experiment=exp)

Now You can run A/B Test on a view

def home(request, template_name="registrations/signup.html"):
    try:
        template_name = request.ab.run(template_name)
    except TemplateDoesNotExist:
        pass
    return render_to_response(template_name)

Development

Want to contribute? Great!

Do the necessary changes that you feel and send a pull request.

Todos

  • Multivariate Testing
  • Add Graphical Information
  • Add Bayesian Formula for the Conversion Rates

License

MIT

Free Software, Hell Yeah!

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc