This project demonstrates how to set up a Django project that interacts with a Langflow instance locally. It includes WebSocket connections handled by Django Channels and the deployment of the application using Docker.
- Python 3.x
- Django
- Docker
- Langflow
First, create a new Django project by running:
django-admin startproject project_nameNavigate to your project directory and start the development server:
python manage.py runserverWithin your Django project, create a new app to handle WebSocket connections:
python manage.py startapp chatRun the Langflow service locally by executing:
langflow % python -m langflow runIf you encounter issues with WebSocket connections, refer to this helpful Stack Overflow discussion.
Navigate to the appropriate directories and build the Docker images for the Django backend and Langflow service:
docker build -t your-docker-username/django-backend:latest .
docker build -t your-docker-username/langflow-service:latest .Push the updated images to your Docker registry:
docker push your-docker-username/django-backend:latest
docker push your-docker-username/langflow-service:latestDeploy the stack using Docker Compose:
docker stack deploy -c docker-compose.yml mystackIn the body include {"username":"your username", "password":"your password"}
http://localhost:8000/api/token/In the body include {"refresh":"token"}
http://localhost:8000/api/token/refresh/In the react-chat folder
npm start