Skip to main content

Django Template with Template, Restframework and Swagger.

Project description

Django RestFramework Swagger Master


  • Django
  • Django Environ
  • Django Template
  • Django RestFramework
  • Django RestFramework Swagger

Save your time and please PR if more feature for django template.


  1. Install Server Firewall

    sudo ufw enable sudo ufw allow ssh sudo ufw allow http sudo ufw allow https sudo ufw allow ftp sudo ufw status

  2. Install Python Environment

    sudo apt-get install python3-dev virtualenv

  3. Install Database Service Mysql

    • install

    sudo apt-get install build-essential mysql-server libmysqlclient-dev

    • service

    sudo ufw allow mysql sudo systemctl start mysql sudo systemctl enable mysql

    • setting root user

    sudo -u root mysql

    USE mysql; UPDATE user SET authentication_string=PASSWORD("rootpassword") WHERE User='root'; UPDATE user SET plugin="mysql_native_password"; FLUSH PRIVILEGES; exit

    • setting new user

    CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword'; GRANT ALL PRIVILEGES ON . TO 'myuser'@'localhost'; FLUSH PRIVILEGES; exit

    mysql -u myuser -p



    • install

    sudo apt-get install libpq-dev postgresql postgresql-contrib

    • service

    sudo ufw allow postgresql sudo systemctl start postgresql sudo systemctl enable postgresql

    • setting root user

    sudo -u postgres psql \password sde \q

    • setting new user


    CREATE USER myuser WITH PASSWORD 'mypassword'; ALTER ROLE myuser SET client_encoding TO 'utf8'; ALTER ROLE myuser SET default_transaction_isolation TO 'read committed'; ALTER ROLE myuser SET timezone TO 'UTC'; GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;


  1. Install Django Project

    • setting secret key

    mv mysite/ mysite/ nano mysite/

    • install virtual environment

    virtualenv -p python3 venv source venv/bin/activate

    • install django project

    pip install -r requirement.txt python makemigrations python migrate python createsuperuser python collectstatic

    • testing django project

    sudo ufw allow 8000 python runserver 0:8000


  1. Install Gunicorn

    pip install gunicorn gunicorn --bind mysite.wsgi

    sudo nano /etc/systemd/system/gunicorn.service

    Description=gunicorn daemon
    ExecStart=/home/ubuntu/django-rest-swagger-master/mysite/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/ubuntu/mysite/mysite.sock mysite.wsgi:application

    sudo systemctl restart gunicorn sudo systemctl enable gunicorn

  2. Install Nginx

    sudo apt-get install nginx sudo nano /etc/nginx/sites-available/mysite

    server {
        listen 80;
        server_name server_domain_or_IP;
        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
            root /home/ubuntu/django-rest-swagger-master;
        location /static/ {
            root /home/ubuntu/django-rest-swagger-master;
        location / {
            include proxy_params;
            proxy_pass http://unix:/home/ubuntu/django-rest-swagger-master/mysite.sock;

    sudo ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled sudo nginx -t sudo systemctl restart nginx sudo ufw allow 'Nginx Full'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-rest-swagger-master-1.0.5.tar.gz (11.4 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page