This folder contains helper scripts for running the CISO Assistant backend in native Windows development.
backend.ps1: PowerShell launcher for the backend..win_native_dev_runserver.py: Djangorunserverwrapper that increases the development server listen backlog.convert_library_v2.bat: Runconvert_library_v2.pylocated inbackendeasily.
Copy the scripts from this folder at these paths from the CISO Assistant repository root:
backend.ps1
backend/.win_native_dev_runserver.pyThen, follow the instructions in the section dedicated to starting the backend.
Copy the script from this folder at this path from the CISO Assistant repository root:
tools/convert_library_v2.batThen start the script when you need it, just as you would with convert_library_v2.py (without python at the beginning). For example:
.\convert_library_v2.bat .\example_framework.xlsxOn native Windows, Django's development server can drain bursts of incoming API
connections more slowly than on Linux. During SvelteKit SSR, the frontend can
open many API connections at once; with Django's small default backlog, Windows
may intermittently return ECONNREFUSED before requests reach Django.
The Python wrapper keeps normal runserver behavior but raises the backlog with
DJANGO_RUNSERVER_BACKLOG (512 by default).
We can't use the tools/convert_library_v2.py symlink, as symlinks don't work on Windows.
- Check the
Requirementssection for Windows in the main README.md file. - Check the section explaining where to place the necessary scripts.
- Check the section about .venv.
- If you want to use PostgreSQL, see this section.
- If you want to run the Enterprise Edition, check the very end of the dedicated documentation in
enterprise/README.md.
- Apply migrations.
# With SQLite
.\backend.ps1 --migrate # .\backend.ps1 -m
# With PostgreSQL
.\backend.ps1 --pg --migrate # .\backend.ps1 -p -m- Create a Django superuser, that will be CISO Assistant administrator
# With SQLite
.\backend.ps1 --createsuperuser # .\backend.ps1 -c
# With PostgreSQL
.\backend.ps1 --pg --createsuperuser # .\backend.ps1 -p -c- Run development server
# With SQLite
.\backend.ps1 --runserver # .\backend.ps1 -r
# With PostgreSQL
.\backend.ps1 --pg --runserver # .\backend.ps1 -p -rStart the backend from the repository root:
# With SQLite
.\backend.ps1
# With PostgreSQL
.\backend.ps1 --pg # .\backend.ps1 -pIn backend.ps1, set $PythonRelativeExecutablePath to the Python executable
that should run Django. A local .venv is recommended because it keeps
dependencies isolated and gives a predictable path, for example:
$PythonRelativeExecutablePath = ".venv\Scripts\python.exe"On Windows, you can also use a PostgreSQL database instead of SQLite. To do so, follow these steps:
- Use the official installer to get PosgreSQL and pgAdmin.
- Open pgAdmin.
- Click
Serversin the right sidebar and enter your password. - Right click
Login/Group Rolesthen clickCreate > Login/Group Roles...- In
General: Enter aName(e.g.ciso-assistantuser). - In
Privileges: Enable everything exceptSuperuser?&Can initiate streaming replication and backups?. - In
Definition: Enter aPassword. - Click
Save.
- In
- Right click on
DatabasesthenCreate > Databases....- In
General:- Enter a
Name(e.g.ciso-assistant). - Set the user you just created as the
Owner(e.g.ciso-assistantuser).
- Enter a
- In
Security:- Click
+. - Select the user you just created as the
Grantee. - Click the blank
Privilegesfield and checkALL.
- Click
- Click
Save.
- In
Once the database has been created, locate the section in the backend.ps1 script that contains the following code:
if ($UsePostgres) {
$PostgresEnvironment = @{
POSTGRES_NAME = "ciso-assistant"
POSTGRES_USER = "ciso-assistantuser"
POSTGRES_PASSWORD = "<XXX>"
DB_HOST = "localhost"
DB_PORT = "5432"
}
#...
}Replace the variable values with the ones you use for you PostgreSQL database.
Note: DB_HOST and DB_PORT are already set to the PostgreSQL default values on Windows.
To start the backend with PostgreSQL, remember to use the -p/--pg parameter every time you run the PowerShell script.