1. Create virtual env following this post 2. Install django (my_env) $ pip3 install psycopg2 (my_env) $ pip3 install django 3. Create django project (my_env) $ django-admin startproject sample_project (my_env) $ python3 manage.py runserver 4. Install postgres following this post 5. Create database $ createdb -U postgres testdb 6. Modify settings in django DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'testdb', 'USER': 'postgres', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': '5432', } } 7. Migrate $ python3 manage.py migrate 8. Create superuser $ python3 manage.py createsuperuser
No comments:
Post a Comment