chg: [app] Added PROD setup and updated README with basic instructions

This commit is contained in:
Sami Mokaddem 2024-06-26 15:46:40 +02:00
parent d39fe6f20c
commit 23c5e3beec
4 changed files with 32 additions and 6 deletions

View file

@ -1,6 +1,30 @@
# misp-exercise-dashboard # misp-exercise-dashboard
This template should help get you started developing with Vue 3 in Vite. ## Installation
```bash
# Setup venv
python3 -m venv venv
source venv/bin/activate
# Install deps
pip3 install -r REQUIREMENTS
```
## Running the PROD setup
```bash
python3 server.py
# Access the page http://localhost:3000 with your browser
```
## Running the DEV setup
```bash
python3 server.py
```
```bash
npm run dev
# Access the page provided by the output of the above command
```
## Recommended IDE Setup ## Recommended IDE Setup

View file

@ -1,3 +1,4 @@
pyzmq pyzmq
python-socketio python-socketio
eventlet eventlet
requests

View file

@ -10,7 +10,6 @@ from eventlet.green import zmq as gzmq
import exercise as exercise_model import exercise as exercise_model
import notification as notification_model import notification as notification_model
import config
import db import db
@ -24,7 +23,10 @@ zsocket.setsockopt_string(gzmq.SUBSCRIBE, '')
# Initialize Socket.IO server # Initialize Socket.IO server
sio = socketio.Server(cors_allowed_origins='*', async_mode='eventlet') sio = socketio.Server(cors_allowed_origins='*', async_mode='eventlet')
app = socketio.WSGIApp(sio) app = socketio.WSGIApp(sio, static_files={
'/': {'content_type': 'text/html', 'filename': 'dist/index.html'},
'/assets': './dist/assets',
})
@sio.event @sio.event
def connect(sid, environ): def connect(sid, environ):

View file

@ -20,8 +20,7 @@ export function resetState() {
const MAX_LIVE_LOG = 30 const MAX_LIVE_LOG = 30
// "undefined" means the URL will be computed from the `window.location` object // "undefined" means the URL will be computed from the `window.location` object
// const URL = process.env.NODE_ENV === "production" ? undefined : "http://localhost:3000"; const URL = process.env.NODE_ENV === "production" ? undefined : "http://localhost:3000";
const URL = "http://localhost:3000";
export const socket = io(URL, { export const socket = io(URL, {
autoConnect: true autoConnect: true