|
1 |
| -# how-to-integrate-django-with-mongo |
| 1 | +# Integrate Django with MongoDB |
| 2 | + |
| 3 | +Code sample on [how to integrate `Django` and `MongoDB`](https://docs.appseed.us/technologies/django/integrate-mongodb/). Open source Django dashboard generated by `AppSeed` as the user interface of the web application. |
| 4 | + |
| 5 | +## Requirements |
| 6 | +To use the following code, you need to have the following tools installed on your computer. |
| 7 | +- Python3 |
| 8 | +- MongoDB server |
| 9 | + |
| 10 | +## Links |
| 11 | +- [Python](https://www.python.org/downloads/) |
| 12 | +- [MongoDB](https://www.mongodb.com/try/download/community) |
| 13 | +- [Django Soft Dashboard](https://github.com/app-generator/django-admin-soft-dashboard) |
| 14 | + |
| 15 | + |
| 16 | +## Features |
| 17 | +- Simple, intuitive codebase - built for beginners (can be extended with ease) |
| 18 | +- `Design`: [Django Soft Dashboard](https://github.com/app-generator/django-admin-soft-dashboard) - Free Version |
| 19 | +- `Sections` covered by the design: |
| 20 | + - Admin section (reserved for superusers) |
| 21 | + - Authentication: Django.contrib.AUTH, Registration |
| 22 | + - All Pages available in for ordinary users |
| 23 | +- `Persistence`: `MongoDB` |
| 24 | + |
| 25 | + |
| 26 | +## How to use the code |
| 27 | +### Start `MongoDB` service |
| 28 | +For **`Unix`, `MacOS`** |
| 29 | +```bash |
| 30 | +$ sudo service mongod start |
| 31 | +``` |
| 32 | + |
| 33 | +For **`Windows`**: |
| 34 | + |
| 35 | +`Mongod` starts automatically when MongoDB is installed as a service. If not check [here](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-windows/#if-you-installed-mongodb-as-a-windows-service) |
| 36 | + |
| 37 | +### Clone the sources |
| 38 | +```bash |
| 39 | +$ git clone https://github.com/app-generator/how-to-integrate-django-with-mongo.git |
| 40 | +$ cd how-to-integrate-django-with-mongo |
| 41 | +``` |
| 42 | +### Create a virtual environment |
| 43 | +For **`Unix`, `MacOS`**: |
| 44 | +```bash |
| 45 | +$ virtualenv -p python3 venv |
| 46 | +$ source venv/bin/activate |
| 47 | +``` |
| 48 | + |
| 49 | +For **`Windows`**: |
| 50 | +```bash |
| 51 | +$ virtualenv venv |
| 52 | +$ .\venv\Scripts\activate.bat |
| 53 | +``` |
| 54 | + |
| 55 | +### Install dependencies using pip |
| 56 | +```bash |
| 57 | +(venv)$ pip install -r requirements.txt |
| 58 | +``` |
| 59 | + |
| 60 | +### Start the API server |
| 61 | +```bash |
| 62 | +(venv)$ python manage.py migrate |
| 63 | +(venv)$ python manage.py createsuperuser # create the admin |
| 64 | +(venv)$ python manage.py runserver |
| 65 | +``` |
| 66 | +At this point, the app runs at `http://127.0.0.1:8000/` |
0 commit comments