Code sample on how to integrate Django
and MongoDB
. Open source Django dashboard generated by AppSeed
as the user interface of the web application.
To use the following code, you need to have the following tools installed on your computer.
- Python3
- MongoDB server
- Simple, intuitive codebase - built for beginners (can be extended with ease)
Design
: Django Soft Dashboard - Free VersionSections
covered by the design:- Admin section (reserved for superusers)
- Authentication: Django.contrib.AUTH, Registration
- All Pages available in for ordinary users
Persistence
:MongoDB
For Unix
, MacOS
$ sudo service mongod start
For Windows
:
Mongod
starts automatically when MongoDB is installed as a service. If not check here
$ git clone https://github.com/app-generator/how-to-integrate-django-with-mongo.git
$ cd how-to-integrate-django-with-mongo
For Unix
, MacOS
:
$ virtualenv -p python3 venv
$ source venv/bin/activate
For Windows
:
$ virtualenv venv
$ .\venv\Scripts\activate.bat
(venv)$ pip install -r requirements.txt
(venv)$ python manage.py migrate
(venv)$ python manage.py createsuperuser # create the admin
(venv)$ python manage.py runserver
At this point, the app runs at http://127.0.0.1:8000/