Deploy a Django‑Based Vulnerability Scanner with Celery, MySQL & Redis

This guide walks you through setting up a Python 3.8/Django 2.2 vulnerability scanner that uses Celery for asynchronous port and background scanning, integrates the AWVS API for vulnerability detection, and requires MySQL and Redis configuration, with detailed deployment steps and troubleshooting tips.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Deploy a Django‑Based Vulnerability Scanner with Celery, MySQL & Redis

Project Overview

This scanner is built on Python 3.8 and Django 2.2, leveraging Celery for asynchronous port and background scanning, and the AWVS API for vulnerability detection.

Prerequisites

Download the project from the provided link.

Activate a virtual environment: venv\Scripts\activate Install project dependencies: pip install -r requirements.txt Install MySQL and Redis, then configure the database in webscanner/settings.py:

# Database configuration using MySQL
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'webscan',
        'USER': 'root',
        'PASSWORD': '',  # set your password here
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

Create a MySQL database named webscan and run migrations: python manage.py makemigrations and python manage.py migrate.

Deployment

Start Redis service: redis-server.exe redis.windows.conf Start Celery worker (Windows):

celery -A celery_tasks.main worker -l info -P eventlet --pool=solo

Run the Django development server: python manage.py runserver and open 127.0.0.1:8000 in a browser.

Seeing the login page confirms successful deployment.

To enable vulnerability scanning, configure the AWVS API key in settings.py (line 130):

# Configure AWVS API key
AWVS_API_KEY = "1986ad8c0a5b3df4d7028d5f3c06e936c4441913fd2af4ef3942a8ef539e98df9"

Demo Screenshots

Redis service started
Redis service started
Celery worker running
Celery worker running
Login page after deployment
Login page after deployment

Common Issues

Vulnerability scanning not working: ensure AWVS is installed and the API key is correctly set in settings.py.

Port or background scanning fails: adjust ports_per_thread in celery_tasks/tasks.py to match your environment.

Home page fails to load: verify database connection and AWVS configuration, as the homepage displays data from both.

Information collection fails: the crawler uses requests + bs4 and may be affected by network conditions; retry or improve the crawler as needed.

pythonRedisMySQLDjangoCeleryvulnerability scanning
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.