{"id":19154568,"url":"https://github.com/gitericsson/natours_django","last_synced_at":"2026-04-08T18:01:39.118Z","repository":{"id":255881278,"uuid":"851742438","full_name":"gitEricsson/Natours_Django","owner":"gitEricsson","description":"Rebuilt Natours using Python’s Django Rest Framework (DRF) to improve scalability and security, while integrating advanced DevOps features. In this iteration, I introduced alternative services, addressed key challenges for seamless functionality, and implemented strong security measures with continuous integration/deployment pipelines.","archived":false,"fork":false,"pushed_at":"2024-11-04T22:10:39.000Z","size":8556,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-03T15:56:30.017Z","etag":null,"topics":["aws-ec2","aws-ecr","ci-cd","circleci","containerization","django-rest-framework","docker","jwt","nginx","postgis","postgresql","python3","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitEricsson.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-03T16:24:15.000Z","updated_at":"2025-10-09T01:57:24.000Z","dependencies_parsed_at":"2024-09-07T17:17:03.965Z","dependency_job_id":"5910a45c-9270-4861-9947-bfc45cfdf114","html_url":"https://github.com/gitEricsson/Natours_Django","commit_stats":null,"previous_names":["gitericsson/natours_django"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gitEricsson/Natours_Django","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitEricsson%2FNatours_Django","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitEricsson%2FNatours_Django/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitEricsson%2FNatours_Django/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitEricsson%2FNatours_Django/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitEricsson","download_url":"https://codeload.github.com/gitEricsson/Natours_Django/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitEricsson%2FNatours_Django/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31567227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-ec2","aws-ecr","ci-cd","circleci","containerization","django-rest-framework","docker","jwt","nginx","postgis","postgresql","python3","redis"],"created_at":"2024-11-09T08:27:22.989Z","updated_at":"2026-04-08T18:01:39.085Z","avatar_url":"https://github.com/gitEricsson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Natours Django\n\nNatours Django is a robust tour booking application built with Django and Docker. It provides a comprehensive backend for managing tours, bookings, user accounts, and more.\n\n## Table of Contents\n\n1. [🚀 Features](#-features)\n2. [🛠️ Tech Stack](#️-tech-stack)\n3. [📋 Prerequisites](#-prerequisites)\n4. [📁 Project Structure](#-project-structure)\n5. [🔧 Setup and Installation](#-setup-and-installation)\n6. [🚀 Running the Application](#-running-the-application)\n7. [🧪 Testing](#-testing)\n8. [📄 API Documentation](#-api-documentation)\n9. [📊 Database](#-database)\n10. [🔑 Environment Variables](#-environment-variables)\n11. [🐳 Docker Configuration](#-docker-configuration)\n12. [🚀 Deployment](#-deployment)\n13. [🤝 Contributing](#-contributing)\n14. [📄 License](#-license)\n15. [👥 Authors](#-authors)\n16. [🙏 Acknowledgments](#-acknowledgments)\n17. [📧 Contact](#-contact)\n\n## 🚀 Features\n\n- User authentication and authorization\n- Tour management with geospatial features\n- Booking system\n- Review system\n- Appointment scheduling\n- Social authentication\n- Email notifications (using Brevo)\n- API documentation with Swagger\n\n## 🛠️ Tech Stack\n\n- **Backend**: Django, Django REST Framework\n- **Database**: PostgreSQL with PostGIS extension, RDS\n- **Containerization**: Docker\n- **Caching**: Redis\n- **Task Queue**: Celery\n- **Reverse Proxy**: Nginx\n- **Cloud Platform**: AWS (ECR \u0026 EC2)\n- **Continous Integration/Continous Deployment(CI/CD)**: CircleCI\n- **Authentication**: JWT\n\n## 📋 Prerequisites\n\n- Docker and Docker Compose\n- Python 3.11+\n- PostgreSQL with PostGIS\n- GDAL library\n- AWS Account with appropriate permissions\n- AWS CLI installed and configured\n- Domain name (optional, but recommended for production)\n\n## 📁 Project Structure\n\n```\nnatours_django/\n├── appointments/       # Tour appointment management\n├── bookings/           # Booking logic and models\n├── dev-data/           # Development data and loaders\n├── reviews/            # Tour review system\n├── social_auth/        # Social authentication\n├── tours/              # Tour management and geospatial features\n├── users/              # User management\n├── Natours_Django/     # Main project settings\n├── nginx/              # Nginx configuration for production\n├── docker-compose.yml  # Docker Compose configuration\n├── Dockerfile          # Docker configuration for development\n├── Dockerfile.prod     # Docker configuration for production\n├── requirements.txt    # Python dependencies\n└── manage.py           # Django management script\n```\n\n## 🔧 Setup and Installation\n\n1. Clone the repository:\n\n   ```\n   git clone https://github.com/your-username/natours-django.git\n   cd natours-django\n   ```\n\n2. Create environment files:\n\n   Create `.env`:\n\n   ```\n   SECRET_KEY=your_secret_key\n   DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]\n   SQL_ENGINE=django.contrib.gis.db.backends.postgis\n   SQL_DATABASE=natours_dev\n   SQL_USER=natours_user\n   SQL_PASSWORD=natours_password\n   SQL_HOST=db\n   SQL_PORT=5432\n   DATABASE=postgres\n   DJANGO_INITIALIZE_DATA=true\n   ```\n\n   Create `.env.db`:\n\n   ```\n   POSTGRES_USER=natours_user\n   POSTGRES_PASSWORD=natours_password\n   POSTGRES_DB=natours_dev\n   ```\n\n3. Build and run with Docker:\n\n   ```\n   docker-compose up --build\n   ```\n\n4. Initialize the database (first time only):\n   ```\n   docker-compose exec web python manage.py migrate\n   docker-compose exec web python dev-data/data/data_loader.py --import\n   docker-compose exec web python dev-data/data/data_loader.py --importDates\n   ```\n\n## 🚀 Running the Application\n\n1. Set up AWS RDS with PostGIS:\n\n   - Create PostgreSQL instance\n   - Enable PostGIS extension\n   - Configure security groups\n\n2. Update environment variables for production:\n\n   - Set DEBUG=0\n   - Update DATABASE_URL with RDS credentials\n   - Configure allowed hosts\n\n3. Deploy using Docker:\n\n   - For development:\n\n   ```\n   docker-compose -f docker-compose.dev.yml up --build\n   ```\n\n   - For production:\n\n   ```\n   docker-compose -f docker-compose.prod.yml up --build\n   ```\n\n4. Access development server:\n   - Main application: http://localhost:8000\n   - Admin interface: http://localhost:8000/admin\n\nThe application will be available at `http://localhost:8000` for development and `http://localhost:80` for production.\n\n## 🧪 Testing\n\nRun tests using:\n\n```bash\ndocker-compose exec web python manage.py test\n```\n\n## 📄 API Documentation\n\nAPI documentation is available using Swagger. After running the application, visit:\n\n```\nhttp://localhost:8000/swagger/\n```\n\n## 📊 Database\n\nThe project uses PostgreSQL with PostGIS extension for geospatial features. The database configuration can be found in the `DATABASES` setting in `settings.py`:\n\n```133:142:Natours_Django/settings.py\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.contrib.gis.db.backends.postgis',\n        'NAME': os.environ.get('SQL_DATABASE', 'Natours_Django'),\n        'USER': os.environ.get('SQL_USER', 'postgres'),\n        'PASSWORD': os.environ.get('SQL_PASSWORD', ''),\n        'HOST': os.environ.get('SQL_HOST', 'localhost'),\n        'PORT': os.environ.get('SQL_PORT', '5432'),\n    }\n}\n```\n\n## 🔑 Environment Variables\n\nKey environment variables are stored in the `.env` and `.env.db` files. Make sure to keep these files secure and never commit them to version control.\n\n## 🐳 Docker Configuration\n\nThe project includes separate Dockerfiles for development and production:\n\n- `Dockerfile`: Development configuration\n- `Dockerfile.prod`: Production configuration\n\nDocker Compose files:\n\n- `docker-compose.dev.yml`: Development setup\n- `docker-compose.prod.yml`: Production setup\n\n## 🚀 Deployment\n\nFor AWS production deployment:\n\n1. Update the `DJANGO_ALLOWED_HOSTS` in your `.env` file with your domain.\n\n2. Build the Docker images:\n\n   ```bash\n   docker-compose -f docker-compose.staging.yml build\n   ```\n\n3. Log in to AWS ECR repository:\n\n   ```bash\n   aws ecr get-login-password --region \u003caws-region\u003e | docker login --username AWS --password-stdin \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com\n   ```\n\n4. Tag and Push images to ECR:\n\n   ```bash\n   docker tag natours-django_web:latest \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com/natours-django:web\n   docker tag natours-django_nginx:latest \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com/natours-django:nginx\n   docker push \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com/natours-django:web\n   docker push \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com/natours-django:nginx\n   ```\n\n5. On your EC2 instance, copy required files:\n\n   ```bash\n   scp -i /path/to/your/key.pem \\\n       -r $(pwd)/{app,nginx,.env.staging,.env.staging.proxy-companion,docker-compose.staging.yml} \\\n       ubuntu@\u003cec2-instance-ip\u003e:/path/to/project\n   ```\n\n6. SSH into your EC2 instance:\n\n   ```bash\n   ssh -i /path/to/your/key.pem ubuntu@\u003cec2-instance-ip\u003e\n   cd /path/to/project\n   ```\n\n7. Log in to ECR and pull images:\n\n   ```bash\n   aws ecr get-login-password --region \u003caws-region\u003e | docker login --username AWS --password-stdin \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com\n   docker pull \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com/django-ec2:web\n   docker pull \u003caws-account-id\u003e.dkr.ecr.\u003caws-region\u003e.amazonaws.com/django-ec2:nginx-proxy\n   ```\n\n8. Run the containers:\n   ```bash\n   docker-compose -f docker-compose.staging.yml up -d\n   ```\n\nNote: When first accessing your domain, you may see a certificate security warning. This is expected if using a staging certificate. Click \"Advanced\" and then \"Proceed\" to access your application.\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License.\n\n## 👥 Authors\n\n- Ericsson Raphael - Initial work\n\n## 🙏 Acknowledgments\n\n- Natours project inspiration\n\n## 📧 Contact\n\nFor questions and support, please email: ericssonraphael@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitericsson%2Fnatours_django","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitericsson%2Fnatours_django","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitericsson%2Fnatours_django/lists"}