{% with step_list="welcome,database,migrate,admin_user,done" %}
First-time Setup Wizard
{% for label, key in step_labels %}
{% if step_index > forloop.counter0 %}βœ“ {% endif %}{{ label }}
{% endfor %}
{% if step == "welcome" %}

Welcome to Narinest Admin πŸ‘‹

This wizard will guide you through configuring your database connection, running migrations, and creating your first admin account.

You only need to do this once after deploying to your server.

What this wizard does:
  • Saves database credentials to .env
  • Runs Django migrations to create all required tables
  • Creates your admin login account
{% csrf_token %}
{% elif step == "database" %}

Database Configuration

Enter your MySQL database credentials. Click Test Connection first to verify before saving.

{% if test_result %}
{% if test_ok %}βœ“ Connected{% else %}βœ— Failed{% endif %}: {{ test_result }}
{% endif %}
{% csrf_token %}
Leave blank if no password is set
E.g. admin.sewahub.com.np, localhost β€” leave blank to allow all hosts
{% elif step == "migrate" %}

Run Database Migrations

This will create all required Django tables (auth, sessions, admin) in your database. Your existing app tables will not be modified.

{% if migrate_ok is not None %}
{% if migrate_ok %} βœ“ Migrations completed successfully! {% else %} βœ— Migration failed β€” see output below. {% endif %}
{% if migrate_output %}
{{ migrate_output }}
{% endif %} {% if migrate_ok %}
{% csrf_token %}
{% endif %} {% else %}
⚠ Ready to run: python manage.py migrate
{% csrf_token %}
{% endif %} {% elif step == "admin_user" %}

Create Admin Account

Create the superuser login you will use to access the Narinest Admin Panel.

{% if errors %}
    {% for e in errors %}
  • {{ e }}
  • {% endfor %}
{% endif %}
{% csrf_token %}
{% elif step == "done" %}
πŸŽ‰

Setup Complete!

Your Narinest Admin Panel is ready to use.

βœ“ What was configured:

  • Database credentials saved to .env
  • All Django auth/session tables created
  • Admin superuser account created
  • Setup wizard locked (won't show again)
Go to Admin Panel β†’
{% endif %}
{% endwith %}