Skip to content

Instantly share code, notes, and snippets.

View mhsamiei's full-sized avatar

mohammad hossein mhsamiei

  • Iran
View GitHub Profile
@mhsamiei
mhsamiei / gonicorn_nginx_django.md
Last active March 5, 2024 13:01
deploy django with nginx and gunicorn config

Testing Gunicorn’s Ability to Serve the Project The last thing we want to do before leaving our virtual environment is test Gunicorn to make sure that it can serve the application. We can do this by entering our project directory and using gunicorn to load the project’s WSGI module:

    (myenv) $ cd ~/myprojectdir
    (myenv) $ gunicorn --bind 0.0.0.0:8000 myproject.wsgi

Creating systemd Socket and Service Files for Gunicorn We have tested that Gunicorn can interact with our Django application, but we should implement a more robust way of starting and stopping the application server. To accomplish this, we’ll make systemd service and socket files.

@mhsamiei
mhsamiei / merge_migration.md
Created August 2, 2020 06:50 — forked from mhipo1364/merge_migration.md
Re-Generate(Merge) Migration Files In Django

Re-Generate Migration

To merge exist migration files into one file:

  • Remove django_migration records table (manually)
  • Remove all migration files
  • run python manage.py migrate --fake command
  • run python manage.py makemigrations command
  • run python manage.py migrate --fake-initial command
  • run python manage.py migrate contenttypes command
@mhsamiei
mhsamiei / tuning_nginx.md
Last active August 2, 2020 06:58
NGINX: upstream timed out