Skip to content

A web platform connecting researchers in Mexico to collaborate on projects, articles, and events. Designed as a specialized networking tool for the CIATEQ community, it helps researchers find collaborators based on expertise, fostering interdisciplinary cooperation.

License

Notifications You must be signed in to change notification settings

amirmx2905/Investigators

Repository files navigation

Investigators

A web platform connecting researchers in Mexico to collaborate on projects, articles, and events. Designed as a specialized networking tool for the CIATEQ community, it helps researchers find collaborators based on expertise, fostering interdisciplinary cooperation.


Tech Stack

Python  Django  PostgreSQL  Django REST Framework  JWT  React  Vite  TailwindCSS  JavaScript  React Router  Axios  ESLint  Docker  Nginx 


Setup Guide

This guide will help you set up the project on either Mac or Windows.

Prerequisites

  • Docker and Docker Compose
  • Git

Installation Steps

1. Clone the Repository

git clone https://github.com/amirmx2905/Investigators.git
cd Investigators

2. Create Environment File

Create a .env file in the Investigators directory with the following content:

# Django settings
DEBUG=True
SECRET_KEY=[|/Ur0JeBDBvuE=?%60p.I9]?V9~rKj{ASSb](O-kzVA\zM>FU #Change this secret key to a random value in production
ALLOWED_HOSTS=localhost,127.0.0.1
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:80,http://localhost

# Database settings
DB_ENGINE=django.db.backends.postgresql
DB_NAME=investigators
DB_USER=postgres
DB_PASSWORD=your_password # Make sure to use a strong password
DB_HOST=db
DB_PORT=5432

# Frontend settings
VITE_API_URL=http://localhost/api

TIME_ZONE=UTC

Note: In the .env file you should only change the DB_PASSWORD field (for database security). The other variables are configured to work with the Docker setup and should remain as provided.


3. Start the Docker Containers

The first time you start the Docker containers you should use the following command:

docker-compose up --build

This command will:

  • Build all necessary Docker images (the --build flag ensures everything is built from scratch)
  • Create containers for PostgreSQL, Django backend, React frontend, and Nginx
  • Set up networking between containers
  • Load initial test data into the database
  • Start all services

4. Access the Application

Once all containers are running, you can access:


5. Default Admin User

The applicacion comes with a pre-configured admin user to access the frontend:

  • Username: admin
  • Password: admin

6. Stopping the Application

To stop all containers, use the following command:

docker-compose down

7. For Subsequent Runs

After the initial build, you can use the following command:

docker-compose up 
#or ctrl+c

8. Rebuilding after Code Changes

If you make changes to the code and need to rebuild:

docker-compose up --build

Project Structure

Investigators/
├── backend/           # Django backend
│   ├── investigators/ # Main app
│   ├── project/       # Project settings
│   ├── manage.py      # Django management script
│   └── requirements.txt
├── frontend/          # React frontend
│   ├── src/           # Source code
│   ├── package.json   # Node dependencies
│   └── vite.config.js # Vite configuration
├── nginx/             # Nginx configuration for production
│   ├── conf/          # Config files
│   └── Dockerfile     # Nginx Docker image
├── docker-compose.yml # Docker services configuration
└── .env               # Environment variables

Working with the Application

You can access the PostgreSQL database using:

# Connect to the PostgreSQL container
docker exec -it investigators-db-1 bash

# Connect to the database
psql -U postgres -d investigators

# Within psql, you can run SQL queries
# For example, list all tables:
\dt

Or using a database tool like DBeaver, connect with:

Host: localhost
Port: 5433 (mapped port in docker-compose)
Database: investigators
User: postgres
Password: your_password (or whatever you set in .env)

Troubleshooting

Port Conflicts

If you see errors about ports already in use:

# Stop any current PostgreSQL service
sudo service postgresql stop  # Linux
brew services stop postgresql # Mac

Or change the external port in docker-compose.yml

ports:
  - "5433:5432"  # Change 5433 to any available port

Container Fails to Start:

Check the logs for specific errors:

docker-compose logs backend
docker-compose logs frontend
docker-compose logs nginx

License

This project is licensed under the MIT License - see the LICENSE file for details.


Authors

About

A web platform connecting researchers in Mexico to collaborate on projects, articles, and events. Designed as a specialized networking tool for the CIATEQ community, it helps researchers find collaborators based on expertise, fostering interdisciplinary cooperation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •