Skip to main content

Overview

PythonAnywhere is a Python-focused Platform-as-a-Service (PaaS) that simplifies Django deployment. OSINT Hub includes a pre-configured WSGI file (pythonanywhere_wsgi.py) specifically designed for PythonAnywhere.
PythonAnywhere free accounts have limitations on external HTTP requests and may restrict some OSINT tool functionality. Consider a paid account for full features.

Prerequisites

  • PythonAnywhere account (free or paid)
  • Basic familiarity with the PythonAnywhere dashboard
  • OSINT Hub repository access

Deployment Steps

1

Create a PythonAnywhere account

Sign up at https://www.pythonanywhere.comChoose a username - this will be part of your app URL: https://YOUR_USERNAME.pythonanywhere.com
2

Open a Bash console

From your PythonAnywhere dashboard:
  • Click on Consoles tab
  • Click Bash to start a new console session
3

Clone the repository

git clone https://github.com/Nakajito/osint_hub.git
cd osint_hub
4

Create a virtual environment

PythonAnywhere requires virtual environments in ~/.virtualenvs/:
mkvirtualenv osint_hub_env --python=/usr/bin/python3.12
The environment will be automatically activated. To activate it later:
workon osint_hub_env
5

Install dependencies

pip install --upgrade pip
pip install -r requirements.txt
This may take 5-10 minutes on PythonAnywhere. Be patient.
6

Configure environment variables

Create a .env file:
cp .env.example .env
nano .env
Update with your PythonAnywhere-specific settings:
SECRET_KEY=your-generated-secret-key
DEBUG=False
ALLOWED_HOSTS=YOUR_USERNAME.pythonanywhere.com
CSRF_TRUSTED_ORIGINS=https://YOUR_USERNAME.pythonanywhere.com
DATABASE_URL=sqlite:///db.sqlite3
Generate a secure SECRET_KEY:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
Replace YOUR_USERNAME with your actual PythonAnywhere username.
7

Run database migrations

python manage.py migrate
8

Collect static files

python manage.py collectstatic --no-input
9

Create superuser (optional)

python manage.py createsuperuser

Web App Configuration

1

Create a new web app

From your PythonAnywhere dashboard:
  • Click on the Web tab
  • Click Add a new web app
  • Choose Manual configuration (not Django wizard)
  • Select Python 3.12
2

Configure source code directory

In the Code section:Source code: /home/YOUR_USERNAME/osint_hubReplace YOUR_USERNAME with your PythonAnywhere username.
3

Configure virtual environment

In the Virtualenv section:Enter path to a virtualenv: /home/YOUR_USERNAME/.virtualenvs/osint_hub_envClick the checkmark to save.
4

Configure WSGI file

In the Code section, click on the WSGI configuration file link (e.g., /var/www/YOUR_USERNAME_pythonanywhere_com_wsgi.py).Delete all the default content and replace it with the contents of pythonanywhere_wsgi.py:
import os
import sys

# ==========================================
# CONFIGURATION - UPDATE THIS
# ==========================================
username = "YOUR_USERNAME"  # Replace with your PythonAnywhere username

# Project directory
path = f"/home/{username}/osint_hub"
if path not in sys.path:
    sys.path.insert(0, path)

# Virtual environment
virtualenv_path = f"/home/{username}/.virtualenvs/osint_hub_env"
activate_this = f"{virtualenv_path}/bin/activate_this.py"

# Activate virtual environment
try:
    with open(activate_this) as file_:
        exec(file_.read(), dict(__file__=activate_this))
except FileNotFoundError:
    print(f"⚠️ WARNING: Virtual environment not found at {virtualenv_path}")
    print("Ensure the virtual environment is created first")

# ==========================================
# DJANGO CONFIGURATION
# ==========================================
os.environ["DJANGO_SETTINGS_MODULE"] = "osint_hub.settings"

# Import Django WSGI application
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Important: Replace YOUR_USERNAME with your actual PythonAnywhere username (appears twice in the file).Click Save at the top of the editor.
5

Configure static files

In the Static files section, add the following mapping:
URLDirectory
/static//home/YOUR_USERNAME/osint_hub/staticfiles/
Click the checkmark to save.
6

Reload the web app

At the top of the Web tab, click the green Reload YOUR_USERNAME.pythonanywhere.com button.Wait for the reload to complete (typically 10-20 seconds).
7

Test your deployment

Visit https://YOUR_USERNAME.pythonanywhere.com in your browser.You should see the OSINT Hub homepage.

PythonAnywhere-Specific Considerations

HTTP Request Whitelist

PythonAnywhere free accounts restrict outbound HTTP requests to whitelisted sites only. Some OSINT tools may not work properly. Affected tools:
  • Email Search (Holehe) - may have limited results
  • Username Search (Sherlock) - may have limited results
  • IP Lookup - uses whitelisted APIs (should work)
Workaround: Upgrade to a paid PythonAnywhere account for unrestricted outbound requests.

No Background Tasks (Free Accounts)

Free PythonAnywhere accounts don’t support long-running background processes like Celery. Impact:
  • Phone Search async tasks won’t work properly
  • Some tools may time out on larger searches
Workaround:
  • Upgrade to a paid account to enable scheduled tasks and always-on tasks
  • Modify views to run synchronously (not recommended for long operations)

File Size Limits

PythonAnywhere has disk quota limits:
  • Free: 512 MB total disk space
  • Paid: Varies by plan
Recommendations:
  • Periodically clean up uploaded files in media/
  • Limit EXIF tool file uploads to essential files only
  • Monitor disk usage in the Files tab

Database Limitations

SQLite (default) works well for small to medium traffic. For high traffic, consider:
  • Upgrading to a paid account with MySQL/PostgreSQL support
  • Configuring a remote PostgreSQL database

Environment Variables in PythonAnywhere

PythonAnywhere doesn’t natively support .env files in the WSGI context. The pythonanywhere_wsgi.py file is already configured to load from .env via python-decouple.

Alternative: Set in WSGI file

You can also set environment variables directly in the WSGI file:
import os

os.environ['SECRET_KEY'] = 'your-secret-key'
os.environ['DEBUG'] = 'False'
os.environ['ALLOWED_HOSTS'] = 'YOUR_USERNAME.pythonanywhere.com'
# ... etc

os.environ["DJANGO_SETTINGS_MODULE"] = "osint_hub.settings"

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
If you set variables in the WSGI file, ensure the file has restricted permissions. Anyone with access to your account can read it.

Troubleshooting

”ImportError” or “ModuleNotFoundError”

Cause: Dependencies not installed or virtual environment not activated. Solution:
workon osint_hub_env
pip install -r requirements.txt
Reload the web app.

Static files not loading (404 errors)

Cause: Static files not collected or incorrect path mapping. Solution:
cd ~/osint_hub
workon osint_hub_env
python manage.py collectstatic --no-input
Verify the static files mapping in the Web tab matches:
  • URL: /static/
  • Directory: /home/YOUR_USERNAME/osint_hub/staticfiles/
Reload the web app.

”DisallowedHost” error

Cause: ALLOWED_HOSTS in .env doesn’t include your PythonAnywhere domain. Solution: Edit .env:
ALLOWED_HOSTS=YOUR_USERNAME.pythonanywhere.com
Reload the web app.

”CSRF verification failed”

Cause: CSRF_TRUSTED_ORIGINS not configured correctly. Solution: Edit .env:
CSRF_TRUSTED_ORIGINS=https://YOUR_USERNAME.pythonanywhere.com
Reload the web app.

Tools not working (HTTP request errors)

Cause: PythonAnywhere whitelist restrictions (free accounts). Solution:

Error logs

View error logs in the Web tab:
  • Click on Log files
  • Check Error log for Python exceptions
  • Check Server log for HTTP errors
Alternatively, view from console:
tail -f /var/log/YOUR_USERNAME.pythonanywhere.com.error.log

Updates and Maintenance

1

Open Bash console

From the Consoles tab, start a new Bash console or reconnect to an existing one.
2

Activate virtual environment

workon osint_hub_env
cd ~/osint_hub
3

Pull latest changes

git pull origin main
4

Update dependencies

pip install --upgrade -r requirements.txt
5

Run migrations

python manage.py migrate
6

Collect static files

python manage.py collectstatic --no-input
7

Reload web app

From the Web tab, click Reload YOUR_USERNAME.pythonanywhere.com.

Custom Domain (Paid Accounts)

Paid PythonAnywhere accounts support custom domains.
1

Configure DNS

Add a CNAME record pointing to YOUR_USERNAME.pythonanywhere.com:
CNAME   www   YOUR_USERNAME.pythonanywhere.com.
2

Update PythonAnywhere settings

In the Web tab, enter your custom domain and save.
3

Update environment variables

Edit .env to include your custom domain:
ALLOWED_HOSTS=YOUR_USERNAME.pythonanywhere.com,www.yourdomain.com
CSRF_TRUSTED_ORIGINS=https://YOUR_USERNAME.pythonanywhere.com,https://www.yourdomain.com
4

Enable HTTPS

PythonAnywhere provides free HTTPS for custom domains. Enable it in the Web tab under Security.

Performance Optimization

Database Indexing

For better query performance:
cd ~/osint_hub
workon osint_hub_env
python manage.py sqlsequencereset email_holehe UsernameSearch PhoneSearch | python manage.py dbshell

Caching

Consider implementing Django caching for frequently accessed data:
# In settings.py
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'osint-hub-cache',
    }
}

Static File Compression

WhiteNoise automatically compresses static files. Ensure it’s enabled in settings.py (already configured):
STORAGES = {
    "staticfiles": {
        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
    },
}

Security Considerations

  • Always set DEBUG=False in production
  • Use a strong, randomly generated SECRET_KEY
  • Regularly update dependencies: pip list --outdated
  • Monitor error logs for suspicious activity
  • Keep your PythonAnywhere account password secure
  • Enable two-factor authentication on your PythonAnywhere account

Next Steps

Build docs developers (and LLMs) love