download python
- python 3.6 +
- browse how to install python properly
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/
lsb_release -cs
-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
By default, Postgres uses an authentication scheme called “peer authentication” for local connections. Basically, this means that if the user’s operating system username matches a valid Postgres username, that user can login with no further authentication.
During the Postgres installation, an operating system user named postgres was created to correspond to the postgres PostgreSQL administrative user. We need to change to this user to perform administrative tasks:
You should now be in a shell session for the postgres user. Log into a Postgres session by typing:
First, we will create a database for our Django project. Each project should have its own isolated database for security reasons. We will call our database myproject in this guide, but it’s always better to select something more descriptive:
Remember to end all commands at an SQL prompt with a semicolon.
Next, we will create a database user which we will use to connect to and interact with the database. Set the password to something strong and secure:
Afterwards, we’ll modify a few of the connection parameters for the user we just created. This will speed up database operations so that the correct values do not have to be queried and set each time a connection is established.
We are setting the default encoding to UTF-8, which Django expects. We are also setting the default transaction isolation scheme to “read committed”, which blocks reads from uncommitted transactions. Lastly, we are setting the timezone. By default, our Django projects will be set to use UTC:
Now, all we need to do is give our database user access rights to the database we created:
Exit the SQL prompt to get back to the postgres user’s shell session:
Exit out of the postgres user’s shell session to get back to your regular user’s shell session:
python -V
Python 3.7.5
pip install virtualenv
virtualenv env
env\scripts\activate
(env) pc-user:
- if your os have installed python 3.7 you can change the version
virtualenv env -p python3.6
source env/bin/activate
(env) pc-user:
https://github.com/ribonred/django-frame.git
cd django-frame
SECRET_KEY = ''
DEBUG = True
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
# set true if u want use postgres, default is false using sqlite3
POSTGRES = False
#configurations postgres
#POSTGRES
DBNAME="your name database"
DBUSER="your name database user"
DBPASSWORD="your name database password"
DBHOST="localhost"
DBPORT=5432
pip install -r requirements.txt
django-admin startproject yourprojectname
- navigate to yourproject folder/yourprojectnamefolder/settings.py
- copy secret key to .env file and delete all yourproject folder
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
- navigate to 127.0.0.1:8000/admin to open django admin
django-admin startapp yourappname backendmodel
- navigate to .app to add your app model
- example
ADDITIONAL_APPS = backendmodel.yourappname1, backendmodel.yourappname2
you can install react vue or frontend framework on frontend folder
pip uninstall asgi_redis
pip uninstall channels-redis
pip uninstall channels # Successfully uninstalled channels-2.1.5
pip install channels
docker-compose -f local.yml up -d