Repository: veryacademy/docker-mastery-with-django Branch: main Commit: ca51bf66af2d Files: 1189 Total size: 16.5 MB Directory structure: gitextract_ml6tap0_/ ├── .gitattributes ├── .gitignore ├── LICENSE ├── Part-07 RabbitMQ with Celery Quick Start Guide/ │ ├── README.md │ ├── app1/ │ │ ├── __init__.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── migrations/ │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── tasks.py │ │ ├── tests.py │ │ └── views.py │ ├── command.txt │ ├── db.sqlite3 │ ├── manage.py │ ├── proj/ │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── celery.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ └── requirements.txt ├── Part-08 PostgreSQL with pgAdmin and Custom Network Config/ │ ├── commands.txt │ ├── core/ │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ ├── docker-compose.yml │ ├── manage.py │ └── requirements.txt ├── Part-1 Dockerize a Django Application/ │ ├── Dockerfile │ ├── commands.txt │ ├── core/ │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── settings.py │ │ ├── templates/ │ │ │ └── index.html │ │ ├── urls.py │ │ ├── views.py │ │ └── wsgi.py │ ├── db.sqlite3 │ ├── dockerignore │ ├── manage.py │ └── requirements.txt ├── Part-2 Build and Start Django in a Container/ │ ├── Dockerfile │ ├── commands.txt │ ├── core/ │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── settings.py │ │ ├── templates/ │ │ │ └── index.html │ │ ├── urls.py │ │ ├── views.py │ │ └── wsgi.py │ ├── db.sqlite3 │ ├── docker-compose.yml │ ├── manage.py │ └── requirements.txt ├── Part-3 Containerize Postgres or MySQL/ │ ├── Dockerfile │ ├── commands.txt │ ├── core/ │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ ├── docker-compose.yml │ ├── manage.py │ └── requirements.txt ├── Part-4 Django Postgres Redis and Celery/ │ ├── Dockerfile │ ├── commands.txt │ ├── core/ │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── celery.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ ├── data/ │ │ └── db/ │ │ ├── PG_VERSION │ │ ├── base/ │ │ │ ├── 1/ │ │ │ │ ├── 112 │ │ │ │ ├── 113 │ │ │ │ ├── 1247 │ │ │ │ ├── 1247_fsm │ │ │ │ ├── 1247_vm │ │ │ │ ├── 1249 │ │ │ │ ├── 1249_fsm │ │ │ │ ├── 1249_vm │ │ │ │ ├── 1255 │ │ │ │ ├── 1255_fsm │ │ │ │ ├── 1255_vm │ │ │ │ ├── 1259 │ │ │ │ ├── 1259_fsm │ │ │ │ ├── 1259_vm │ │ │ │ ├── 13245 │ │ │ │ ├── 13245_fsm │ │ │ │ ├── 13245_vm │ │ │ │ ├── 13247 │ │ │ │ ├── 13249 │ │ │ │ ├── 13250 │ │ │ │ ├── 13250_fsm │ │ │ │ ├── 13250_vm │ │ │ │ ├── 13252 │ │ │ │ ├── 13254 │ │ │ │ ├── 13255 │ │ │ │ ├── 13255_fsm │ │ │ │ ├── 13255_vm │ │ │ │ ├── 13257 │ │ │ │ ├── 13259 │ │ │ │ ├── 13260 │ │ │ │ ├── 13260_fsm │ │ │ │ ├── 13260_vm │ │ │ │ ├── 13262 │ │ │ │ ├── 13264 │ │ │ │ ├── 1417 │ │ │ │ ├── 1418 │ │ │ │ ├── 174 │ │ │ │ ├── 175 │ │ │ │ ├── 2187 │ │ │ │ ├── 2224 │ │ │ │ ├── 2328 │ │ │ │ ├── 2336 │ │ │ │ ├── 2337 │ │ │ │ ├── 2579 │ │ │ │ ├── 2600 │ │ │ │ ├── 2600_fsm │ │ │ │ ├── 2600_vm │ │ │ │ ├── 2601 │ │ │ │ ├── 2601_fsm │ │ │ │ ├── 2601_vm │ │ │ │ ├── 2602 │ │ │ │ ├── 2602_fsm │ │ │ │ ├── 2602_vm │ │ │ │ ├── 2603 │ │ │ │ ├── 2603_fsm │ │ │ │ ├── 2603_vm │ │ │ │ ├── 2604 │ │ │ │ ├── 2605 │ │ │ │ ├── 2605_fsm │ │ │ │ ├── 2605_vm │ │ │ │ ├── 2606 │ │ │ │ ├── 2606_fsm │ │ │ │ ├── 2606_vm │ │ │ │ ├── 2607 │ │ │ │ ├── 2607_fsm │ │ │ │ ├── 2607_vm │ │ │ │ ├── 2608 │ │ │ │ ├── 2608_fsm │ │ │ │ ├── 2608_vm │ │ │ │ ├── 2609 │ │ │ │ ├── 2609_fsm │ │ │ │ ├── 2609_vm │ │ │ │ ├── 2610 │ │ │ │ ├── 2610_fsm │ │ │ │ ├── 2610_vm │ │ │ │ ├── 2611 │ │ │ │ ├── 2612 │ │ │ │ ├── 2612_fsm │ │ │ │ ├── 2612_vm │ │ │ │ ├── 2613 │ │ │ │ ├── 2615 │ │ │ │ ├── 2615_fsm │ │ │ │ ├── 2615_vm │ │ │ │ ├── 2616 │ │ │ │ ├── 2616_fsm │ │ │ │ ├── 2616_vm │ │ │ │ ├── 2617 │ │ │ │ ├── 2617_fsm │ │ │ │ ├── 2617_vm │ │ │ │ ├── 2618 │ │ │ │ ├── 2618_fsm │ │ │ │ ├── 2618_vm │ │ │ │ ├── 2619 │ │ │ │ ├── 2619_fsm │ │ │ │ ├── 2619_vm │ │ │ │ ├── 2620 │ │ │ │ ├── 2650 │ │ │ │ ├── 2651 │ │ │ │ ├── 2652 │ │ │ │ ├── 2653 │ │ │ │ ├── 2654 │ │ │ │ ├── 2655 │ │ │ │ ├── 2656 │ │ │ │ ├── 2657 │ │ │ │ ├── 2658 │ │ │ │ ├── 2659 │ │ │ │ ├── 2660 │ │ │ │ ├── 2661 │ │ │ │ ├── 2662 │ │ │ │ ├── 2663 │ │ │ │ ├── 2664 │ │ │ │ ├── 2665 │ │ │ │ ├── 2666 │ │ │ │ ├── 2667 │ │ │ │ ├── 2668 │ │ │ │ ├── 2669 │ │ │ │ ├── 2670 │ │ │ │ ├── 2673 │ │ │ │ ├── 2674 │ │ │ │ ├── 2675 │ │ │ │ ├── 2678 │ │ │ │ ├── 2679 │ │ │ │ ├── 2680 │ │ │ │ ├── 2681 │ │ │ │ ├── 2682 │ │ │ │ ├── 2683 │ │ │ │ ├── 2684 │ │ │ │ ├── 2685 │ │ │ │ ├── 2686 │ │ │ │ ├── 2687 │ │ │ │ ├── 2688 │ │ │ │ ├── 2689 │ │ │ │ ├── 2690 │ │ │ │ ├── 2691 │ │ │ │ ├── 2692 │ │ │ │ ├── 2693 │ │ │ │ ├── 2696 │ │ │ │ ├── 2699 │ │ │ │ ├── 2701 │ │ │ │ ├── 2702 │ │ │ │ ├── 2703 │ │ │ │ ├── 2704 │ │ │ │ ├── 2753 │ │ │ │ ├── 2753_fsm │ │ │ │ ├── 2753_vm │ │ │ │ ├── 2754 │ │ │ │ ├── 2755 │ │ │ │ ├── 2756 │ │ │ │ ├── 2757 │ │ │ │ ├── 2830 │ │ │ │ ├── 2831 │ │ │ │ ├── 2832 │ │ │ │ ├── 2833 │ │ │ │ ├── 2834 │ │ │ │ ├── 2835 │ │ │ │ ├── 2836 │ │ │ │ ├── 2837 │ │ │ │ ├── 2838 │ │ │ │ ├── 2838_fsm │ │ │ │ ├── 2838_vm │ │ │ │ ├── 2839 │ │ │ │ ├── 2840 │ │ │ │ ├── 2840_fsm │ │ │ │ ├── 2840_vm │ │ │ │ ├── 2841 │ │ │ │ ├── 2995 │ │ │ │ ├── 2996 │ │ │ │ ├── 3079 │ │ │ │ ├── 3079_fsm │ │ │ │ ├── 3079_vm │ │ │ │ ├── 3080 │ │ │ │ ├── 3081 │ │ │ │ ├── 3085 │ │ │ │ ├── 3118 │ │ │ │ ├── 3119 │ │ │ │ ├── 3164 │ │ │ │ ├── 3256 │ │ │ │ ├── 3257 │ │ │ │ ├── 3258 │ │ │ │ ├── 3350 │ │ │ │ ├── 3351 │ │ │ │ ├── 3379 │ │ │ │ ├── 3380 │ │ │ │ ├── 3381 │ │ │ │ ├── 3394 │ │ │ │ ├── 3394_fsm │ │ │ │ ├── 3394_vm │ │ │ │ ├── 3395 │ │ │ │ ├── 3429 │ │ │ │ ├── 3430 │ │ │ │ ├── 3431 │ │ │ │ ├── 3433 │ │ │ │ ├── 3439 │ │ │ │ ├── 3440 │ │ │ │ ├── 3455 │ │ │ │ ├── 3456 │ │ │ │ ├── 3456_fsm │ │ │ │ ├── 3456_vm │ │ │ │ ├── 3466 │ │ │ │ ├── 3467 │ │ │ │ ├── 3468 │ │ │ │ ├── 3501 │ │ │ │ ├── 3502 │ │ │ │ ├── 3503 │ │ │ │ ├── 3534 │ │ │ │ ├── 3541 │ │ │ │ ├── 3541_fsm │ │ │ │ ├── 3541_vm │ │ │ │ ├── 3542 │ │ │ │ ├── 3574 │ │ │ │ ├── 3575 │ │ │ │ ├── 3576 │ │ │ │ ├── 3596 │ │ │ │ ├── 3597 │ │ │ │ ├── 3598 │ │ │ │ ├── 3599 │ │ │ │ ├── 3600 │ │ │ │ ├── 3600_fsm │ │ │ │ ├── 3600_vm │ │ │ │ ├── 3601 │ │ │ │ ├── 3601_fsm │ │ │ │ ├── 3601_vm │ │ │ │ ├── 3602 │ │ │ │ ├── 3602_fsm │ │ │ │ ├── 3602_vm │ │ │ │ ├── 3603 │ │ │ │ ├── 3603_fsm │ │ │ │ ├── 3603_vm │ │ │ │ ├── 3604 │ │ │ │ ├── 3605 │ │ │ │ ├── 3606 │ │ │ │ ├── 3607 │ │ │ │ ├── 3608 │ │ │ │ ├── 3609 │ │ │ │ ├── 3712 │ │ │ │ ├── 3764 │ │ │ │ ├── 3764_fsm │ │ │ │ ├── 3764_vm │ │ │ │ ├── 3766 │ │ │ │ ├── 3767 │ │ │ │ ├── 3997 │ │ │ │ ├── 4143 │ │ │ │ ├── 4144 │ │ │ │ ├── 4145 │ │ │ │ ├── 4146 │ │ │ │ ├── 4147 │ │ │ │ ├── 4148 │ │ │ │ ├── 4149 │ │ │ │ ├── 4150 │ │ │ │ ├── 4151 │ │ │ │ ├── 4152 │ │ │ │ ├── 4153 │ │ │ │ ├── 4154 │ │ │ │ ├── 4155 │ │ │ │ ├── 4156 │ │ │ │ ├── 4157 │ │ │ │ ├── 4158 │ │ │ │ ├── 4159 │ │ │ │ ├── 4160 │ │ │ │ ├── 4161 │ │ │ │ ├── 4162 │ │ │ │ ├── 4163 │ │ │ │ ├── 4164 │ │ │ │ ├── 4165 │ │ │ │ ├── 4166 │ │ │ │ ├── 4167 │ │ │ │ ├── 4168 │ │ │ │ ├── 4169 │ │ │ │ ├── 4170 │ │ │ │ ├── 4171 │ │ │ │ ├── 4172 │ │ │ │ ├── 4173 │ │ │ │ ├── 4174 │ │ │ │ ├── 5002 │ │ │ │ ├── 548 │ │ │ │ ├── 549 │ │ │ │ ├── 6102 │ │ │ │ ├── 6104 │ │ │ │ ├── 6106 │ │ │ │ ├── 6110 │ │ │ │ ├── 6111 │ │ │ │ ├── 6112 │ │ │ │ ├── 6113 │ │ │ │ ├── 6117 │ │ │ │ ├── 826 │ │ │ │ ├── 827 │ │ │ │ ├── 828 │ │ │ │ └── PG_VERSION │ │ │ ├── 13394/ │ │ │ │ ├── 112 │ │ │ │ ├── 113 │ │ │ │ ├── 1247 │ │ │ │ ├── 1247_fsm │ │ │ │ ├── 1247_vm │ │ │ │ ├── 1249 │ │ │ │ ├── 1249_fsm │ │ │ │ ├── 1249_vm │ │ │ │ ├── 1255 │ │ │ │ ├── 1255_fsm │ │ │ │ ├── 1255_vm │ │ │ │ ├── 1259 │ │ │ │ ├── 1259_fsm │ │ │ │ ├── 1259_vm │ │ │ │ ├── 13245 │ │ │ │ ├── 13245_fsm │ │ │ │ ├── 13245_vm │ │ │ │ ├── 13247 │ │ │ │ ├── 13249 │ │ │ │ ├── 13250 │ │ │ │ ├── 13250_fsm │ │ │ │ ├── 13250_vm │ │ │ │ ├── 13252 │ │ │ │ ├── 13254 │ │ │ │ ├── 13255 │ │ │ │ ├── 13255_fsm │ │ │ │ ├── 13255_vm │ │ │ │ ├── 13257 │ │ │ │ ├── 13259 │ │ │ │ ├── 13260 │ │ │ │ ├── 13260_fsm │ │ │ │ ├── 13260_vm │ │ │ │ ├── 13262 │ │ │ │ ├── 13264 │ │ │ │ ├── 1417 │ │ │ │ ├── 1418 │ │ │ │ ├── 174 │ │ │ │ ├── 175 │ │ │ │ ├── 2187 │ │ │ │ ├── 2224 │ │ │ │ ├── 2328 │ │ │ │ ├── 2336 │ │ │ │ ├── 2337 │ │ │ │ ├── 2579 │ │ │ │ ├── 2600 │ │ │ │ ├── 2600_fsm │ │ │ │ ├── 2600_vm │ │ │ │ ├── 2601 │ │ │ │ ├── 2601_fsm │ │ │ │ ├── 2601_vm │ │ │ │ ├── 2602 │ │ │ │ ├── 2602_fsm │ │ │ │ ├── 2602_vm │ │ │ │ ├── 2603 │ │ │ │ ├── 2603_fsm │ │ │ │ ├── 2603_vm │ │ │ │ ├── 2604 │ │ │ │ ├── 2605 │ │ │ │ ├── 2605_fsm │ │ │ │ ├── 2605_vm │ │ │ │ ├── 2606 │ │ │ │ ├── 2606_fsm │ │ │ │ ├── 2606_vm │ │ │ │ ├── 2607 │ │ │ │ ├── 2607_fsm │ │ │ │ ├── 2607_vm │ │ │ │ ├── 2608 │ │ │ │ ├── 2608_fsm │ │ │ │ ├── 2608_vm │ │ │ │ ├── 2609 │ │ │ │ ├── 2609_fsm │ │ │ │ ├── 2609_vm │ │ │ │ ├── 2610 │ │ │ │ ├── 2610_fsm │ │ │ │ ├── 2610_vm │ │ │ │ ├── 2611 │ │ │ │ ├── 2612 │ │ │ │ ├── 2612_fsm │ │ │ │ ├── 2612_vm │ │ │ │ ├── 2613 │ │ │ │ ├── 2615 │ │ │ │ ├── 2615_fsm │ │ │ │ ├── 2615_vm │ │ │ │ ├── 2616 │ │ │ │ ├── 2616_fsm │ │ │ │ ├── 2616_vm │ │ │ │ ├── 2617 │ │ │ │ ├── 2617_fsm │ │ │ │ ├── 2617_vm │ │ │ │ ├── 2618 │ │ │ │ ├── 2618_fsm │ │ │ │ ├── 2618_vm │ │ │ │ ├── 2619 │ │ │ │ ├── 2619_fsm │ │ │ │ ├── 2619_vm │ │ │ │ ├── 2620 │ │ │ │ ├── 2650 │ │ │ │ ├── 2651 │ │ │ │ ├── 2652 │ │ │ │ ├── 2653 │ │ │ │ ├── 2654 │ │ │ │ ├── 2655 │ │ │ │ ├── 2656 │ │ │ │ ├── 2657 │ │ │ │ ├── 2658 │ │ │ │ ├── 2659 │ │ │ │ ├── 2660 │ │ │ │ ├── 2661 │ │ │ │ ├── 2662 │ │ │ │ ├── 2663 │ │ │ │ ├── 2664 │ │ │ │ ├── 2665 │ │ │ │ ├── 2666 │ │ │ │ ├── 2667 │ │ │ │ ├── 2668 │ │ │ │ ├── 2669 │ │ │ │ ├── 2670 │ │ │ │ ├── 2673 │ │ │ │ ├── 2674 │ │ │ │ ├── 2675 │ │ │ │ ├── 2678 │ │ │ │ ├── 2679 │ │ │ │ ├── 2680 │ │ │ │ ├── 2681 │ │ │ │ ├── 2682 │ │ │ │ ├── 2683 │ │ │ │ ├── 2684 │ │ │ │ ├── 2685 │ │ │ │ ├── 2686 │ │ │ │ ├── 2687 │ │ │ │ ├── 2688 │ │ │ │ ├── 2689 │ │ │ │ ├── 2690 │ │ │ │ ├── 2691 │ │ │ │ ├── 2692 │ │ │ │ ├── 2693 │ │ │ │ ├── 2696 │ │ │ │ ├── 2699 │ │ │ │ ├── 2701 │ │ │ │ ├── 2702 │ │ │ │ ├── 2703 │ │ │ │ ├── 2704 │ │ │ │ ├── 2753 │ │ │ │ ├── 2753_fsm │ │ │ │ ├── 2753_vm │ │ │ │ ├── 2754 │ │ │ │ ├── 2755 │ │ │ │ ├── 2756 │ │ │ │ ├── 2757 │ │ │ │ ├── 2830 │ │ │ │ ├── 2831 │ │ │ │ ├── 2832 │ │ │ │ ├── 2833 │ │ │ │ ├── 2834 │ │ │ │ ├── 2835 │ │ │ │ ├── 2836 │ │ │ │ ├── 2837 │ │ │ │ ├── 2838 │ │ │ │ ├── 2838_fsm │ │ │ │ ├── 2838_vm │ │ │ │ ├── 2839 │ │ │ │ ├── 2840 │ │ │ │ ├── 2840_fsm │ │ │ │ ├── 2840_vm │ │ │ │ ├── 2841 │ │ │ │ ├── 2995 │ │ │ │ ├── 2996 │ │ │ │ ├── 3079 │ │ │ │ ├── 3079_fsm │ │ │ │ ├── 3079_vm │ │ │ │ ├── 3080 │ │ │ │ ├── 3081 │ │ │ │ ├── 3085 │ │ │ │ ├── 3118 │ │ │ │ ├── 3119 │ │ │ │ ├── 3164 │ │ │ │ ├── 3256 │ │ │ │ ├── 3257 │ │ │ │ ├── 3258 │ │ │ │ ├── 3350 │ │ │ │ ├── 3351 │ │ │ │ ├── 3379 │ │ │ │ ├── 3380 │ │ │ │ ├── 3381 │ │ │ │ ├── 3394 │ │ │ │ ├── 3394_fsm │ │ │ │ ├── 3394_vm │ │ │ │ ├── 3395 │ │ │ │ ├── 3429 │ │ │ │ ├── 3430 │ │ │ │ ├── 3431 │ │ │ │ ├── 3433 │ │ │ │ ├── 3439 │ │ │ │ ├── 3440 │ │ │ │ ├── 3455 │ │ │ │ ├── 3456 │ │ │ │ ├── 3456_fsm │ │ │ │ ├── 3456_vm │ │ │ │ ├── 3466 │ │ │ │ ├── 3467 │ │ │ │ ├── 3468 │ │ │ │ ├── 3501 │ │ │ │ ├── 3502 │ │ │ │ ├── 3503 │ │ │ │ ├── 3534 │ │ │ │ ├── 3541 │ │ │ │ ├── 3541_fsm │ │ │ │ ├── 3541_vm │ │ │ │ ├── 3542 │ │ │ │ ├── 3574 │ │ │ │ ├── 3575 │ │ │ │ ├── 3576 │ │ │ │ ├── 3596 │ │ │ │ ├── 3597 │ │ │ │ ├── 3598 │ │ │ │ ├── 3599 │ │ │ │ ├── 3600 │ │ │ │ ├── 3600_fsm │ │ │ │ ├── 3600_vm │ │ │ │ ├── 3601 │ │ │ │ ├── 3601_fsm │ │ │ │ ├── 3601_vm │ │ │ │ ├── 3602 │ │ │ │ ├── 3602_fsm │ │ │ │ ├── 3602_vm │ │ │ │ ├── 3603 │ │ │ │ ├── 3603_fsm │ │ │ │ ├── 3603_vm │ │ │ │ ├── 3604 │ │ │ │ ├── 3605 │ │ │ │ ├── 3606 │ │ │ │ ├── 3607 │ │ │ │ ├── 3608 │ │ │ │ ├── 3609 │ │ │ │ ├── 3712 │ │ │ │ ├── 3764 │ │ │ │ ├── 3764_fsm │ │ │ │ ├── 3764_vm │ │ │ │ ├── 3766 │ │ │ │ ├── 3767 │ │ │ │ ├── 3997 │ │ │ │ ├── 4143 │ │ │ │ ├── 4144 │ │ │ │ ├── 4145 │ │ │ │ ├── 4146 │ │ │ │ ├── 4147 │ │ │ │ ├── 4148 │ │ │ │ ├── 4149 │ │ │ │ ├── 4150 │ │ │ │ ├── 4151 │ │ │ │ ├── 4152 │ │ │ │ ├── 4153 │ │ │ │ ├── 4154 │ │ │ │ ├── 4155 │ │ │ │ ├── 4156 │ │ │ │ ├── 4157 │ │ │ │ ├── 4158 │ │ │ │ ├── 4159 │ │ │ │ ├── 4160 │ │ │ │ ├── 4161 │ │ │ │ ├── 4162 │ │ │ │ ├── 4163 │ │ │ │ ├── 4164 │ │ │ │ ├── 4165 │ │ │ │ ├── 4166 │ │ │ │ ├── 4167 │ │ │ │ ├── 4168 │ │ │ │ ├── 4169 │ │ │ │ ├── 4170 │ │ │ │ ├── 4171 │ │ │ │ ├── 4172 │ │ │ │ ├── 4173 │ │ │ │ ├── 4174 │ │ │ │ ├── 5002 │ │ │ │ ├── 548 │ │ │ │ ├── 549 │ │ │ │ ├── 6102 │ │ │ │ ├── 6104 │ │ │ │ ├── 6106 │ │ │ │ ├── 6110 │ │ │ │ ├── 6111 │ │ │ │ ├── 6112 │ │ │ │ ├── 6113 │ │ │ │ ├── 6117 │ │ │ │ ├── 826 │ │ │ │ ├── 827 │ │ │ │ ├── 828 │ │ │ │ └── PG_VERSION │ │ │ └── 13395/ │ │ │ ├── 112 │ │ │ ├── 113 │ │ │ ├── 1247 │ │ │ ├── 1247_fsm │ │ │ ├── 1247_vm │ │ │ ├── 1249 │ │ │ ├── 1249_fsm │ │ │ ├── 1249_vm │ │ │ ├── 1255 │ │ │ ├── 1255_fsm │ │ │ ├── 1255_vm │ │ │ ├── 1259 │ │ │ ├── 1259_fsm │ │ │ ├── 1259_vm │ │ │ ├── 13245 │ │ │ ├── 13245_fsm │ │ │ ├── 13245_vm │ │ │ ├── 13247 │ │ │ ├── 13249 │ │ │ ├── 13250 │ │ │ ├── 13250_fsm │ │ │ ├── 13250_vm │ │ │ ├── 13252 │ │ │ ├── 13254 │ │ │ ├── 13255 │ │ │ ├── 13255_fsm │ │ │ ├── 13255_vm │ │ │ ├── 13257 │ │ │ ├── 13259 │ │ │ ├── 13260 │ │ │ ├── 13260_fsm │ │ │ ├── 13260_vm │ │ │ ├── 13262 │ │ │ ├── 13264 │ │ │ ├── 1417 │ │ │ ├── 1418 │ │ │ ├── 174 │ │ │ ├── 175 │ │ │ ├── 2187 │ │ │ ├── 2224 │ │ │ ├── 2328 │ │ │ ├── 2336 │ │ │ ├── 2337 │ │ │ ├── 2579 │ │ │ ├── 2600 │ │ │ ├── 2600_fsm │ │ │ ├── 2600_vm │ │ │ ├── 2601 │ │ │ ├── 2601_fsm │ │ │ ├── 2601_vm │ │ │ ├── 2602 │ │ │ ├── 2602_fsm │ │ │ ├── 2602_vm │ │ │ ├── 2603 │ │ │ ├── 2603_fsm │ │ │ ├── 2603_vm │ │ │ ├── 2604 │ │ │ ├── 2605 │ │ │ ├── 2605_fsm │ │ │ ├── 2605_vm │ │ │ ├── 2606 │ │ │ ├── 2606_fsm │ │ │ ├── 2606_vm │ │ │ ├── 2607 │ │ │ ├── 2607_fsm │ │ │ ├── 2607_vm │ │ │ ├── 2608 │ │ │ ├── 2608_fsm │ │ │ ├── 2608_vm │ │ │ ├── 2609 │ │ │ ├── 2609_fsm │ │ │ ├── 2609_vm │ │ │ ├── 2610 │ │ │ ├── 2610_fsm │ │ │ ├── 2610_vm │ │ │ ├── 2611 │ │ │ ├── 2612 │ │ │ ├── 2612_fsm │ │ │ ├── 2612_vm │ │ │ ├── 2613 │ │ │ ├── 2615 │ │ │ ├── 2615_fsm │ │ │ ├── 2615_vm │ │ │ ├── 2616 │ │ │ ├── 2616_fsm │ │ │ ├── 2616_vm │ │ │ ├── 2617 │ │ │ ├── 2617_fsm │ │ │ ├── 2617_vm │ │ │ ├── 2618 │ │ │ ├── 2618_fsm │ │ │ ├── 2618_vm │ │ │ ├── 2619 │ │ │ ├── 2619_fsm │ │ │ ├── 2619_vm │ │ │ ├── 2620 │ │ │ ├── 2650 │ │ │ ├── 2651 │ │ │ ├── 2652 │ │ │ ├── 2653 │ │ │ ├── 2654 │ │ │ ├── 2655 │ │ │ ├── 2656 │ │ │ ├── 2657 │ │ │ ├── 2658 │ │ │ ├── 2659 │ │ │ ├── 2660 │ │ │ ├── 2661 │ │ │ ├── 2662 │ │ │ ├── 2663 │ │ │ ├── 2664 │ │ │ ├── 2665 │ │ │ ├── 2666 │ │ │ ├── 2667 │ │ │ ├── 2668 │ │ │ ├── 2669 │ │ │ ├── 2670 │ │ │ ├── 2673 │ │ │ ├── 2674 │ │ │ ├── 2675 │ │ │ ├── 2678 │ │ │ ├── 2679 │ │ │ ├── 2680 │ │ │ ├── 2681 │ │ │ ├── 2682 │ │ │ ├── 2683 │ │ │ ├── 2684 │ │ │ ├── 2685 │ │ │ ├── 2686 │ │ │ ├── 2687 │ │ │ ├── 2688 │ │ │ ├── 2689 │ │ │ ├── 2690 │ │ │ ├── 2691 │ │ │ ├── 2692 │ │ │ ├── 2693 │ │ │ ├── 2696 │ │ │ ├── 2699 │ │ │ ├── 2701 │ │ │ ├── 2702 │ │ │ ├── 2703 │ │ │ ├── 2704 │ │ │ ├── 2753 │ │ │ ├── 2753_fsm │ │ │ ├── 2753_vm │ │ │ ├── 2754 │ │ │ ├── 2755 │ │ │ ├── 2756 │ │ │ ├── 2757 │ │ │ ├── 2830 │ │ │ ├── 2831 │ │ │ ├── 2832 │ │ │ ├── 2833 │ │ │ ├── 2834 │ │ │ ├── 2835 │ │ │ ├── 2836 │ │ │ ├── 2837 │ │ │ ├── 2838 │ │ │ ├── 2838_fsm │ │ │ ├── 2838_vm │ │ │ ├── 2839 │ │ │ ├── 2840 │ │ │ ├── 2840_fsm │ │ │ ├── 2840_vm │ │ │ ├── 2841 │ │ │ ├── 2995 │ │ │ ├── 2996 │ │ │ ├── 3079 │ │ │ ├── 3079_fsm │ │ │ ├── 3079_vm │ │ │ ├── 3080 │ │ │ ├── 3081 │ │ │ ├── 3085 │ │ │ ├── 3118 │ │ │ ├── 3119 │ │ │ ├── 3164 │ │ │ ├── 3256 │ │ │ ├── 3257 │ │ │ ├── 3258 │ │ │ ├── 3350 │ │ │ ├── 3351 │ │ │ ├── 3379 │ │ │ ├── 3380 │ │ │ ├── 3381 │ │ │ ├── 3394 │ │ │ ├── 3394_fsm │ │ │ ├── 3394_vm │ │ │ ├── 3395 │ │ │ ├── 3429 │ │ │ ├── 3430 │ │ │ ├── 3431 │ │ │ ├── 3433 │ │ │ ├── 3439 │ │ │ ├── 3440 │ │ │ ├── 3455 │ │ │ ├── 3456 │ │ │ ├── 3456_fsm │ │ │ ├── 3456_vm │ │ │ ├── 3466 │ │ │ ├── 3467 │ │ │ ├── 3468 │ │ │ ├── 3501 │ │ │ ├── 3502 │ │ │ ├── 3503 │ │ │ ├── 3534 │ │ │ ├── 3541 │ │ │ ├── 3541_fsm │ │ │ ├── 3541_vm │ │ │ ├── 3542 │ │ │ ├── 3574 │ │ │ ├── 3575 │ │ │ ├── 3576 │ │ │ ├── 3596 │ │ │ ├── 3597 │ │ │ ├── 3598 │ │ │ ├── 3599 │ │ │ ├── 3600 │ │ │ ├── 3600_fsm │ │ │ ├── 3600_vm │ │ │ ├── 3601 │ │ │ ├── 3601_fsm │ │ │ ├── 3601_vm │ │ │ ├── 3602 │ │ │ ├── 3602_fsm │ │ │ ├── 3602_vm │ │ │ ├── 3603 │ │ │ ├── 3603_fsm │ │ │ ├── 3603_vm │ │ │ ├── 3604 │ │ │ ├── 3605 │ │ │ ├── 3606 │ │ │ ├── 3607 │ │ │ ├── 3608 │ │ │ ├── 3609 │ │ │ ├── 3712 │ │ │ ├── 3764 │ │ │ ├── 3764_fsm │ │ │ ├── 3764_vm │ │ │ ├── 3766 │ │ │ ├── 3767 │ │ │ ├── 3997 │ │ │ ├── 4143 │ │ │ ├── 4144 │ │ │ ├── 4145 │ │ │ ├── 4146 │ │ │ ├── 4147 │ │ │ ├── 4148 │ │ │ ├── 4149 │ │ │ ├── 4150 │ │ │ ├── 4151 │ │ │ ├── 4152 │ │ │ ├── 4153 │ │ │ ├── 4154 │ │ │ ├── 4155 │ │ │ ├── 4156 │ │ │ ├── 4157 │ │ │ ├── 4158 │ │ │ ├── 4159 │ │ │ ├── 4160 │ │ │ ├── 4161 │ │ │ ├── 4162 │ │ │ ├── 4163 │ │ │ ├── 4164 │ │ │ ├── 4165 │ │ │ ├── 4166 │ │ │ ├── 4167 │ │ │ ├── 4168 │ │ │ ├── 4169 │ │ │ ├── 4170 │ │ │ ├── 4171 │ │ │ ├── 4172 │ │ │ ├── 4173 │ │ │ ├── 4174 │ │ │ ├── 5002 │ │ │ ├── 548 │ │ │ ├── 549 │ │ │ ├── 6102 │ │ │ ├── 6104 │ │ │ ├── 6106 │ │ │ ├── 6110 │ │ │ ├── 6111 │ │ │ ├── 6112 │ │ │ ├── 6113 │ │ │ ├── 6117 │ │ │ ├── 826 │ │ │ ├── 827 │ │ │ ├── 828 │ │ │ ├── PG_VERSION │ │ │ └── pg_internal.init │ │ ├── global/ │ │ │ ├── 1213 │ │ │ ├── 1213_fsm │ │ │ ├── 1213_vm │ │ │ ├── 1214 │ │ │ ├── 1214_fsm │ │ │ ├── 1214_vm │ │ │ ├── 1232 │ │ │ ├── 1233 │ │ │ ├── 1260 │ │ │ ├── 1260_fsm │ │ │ ├── 1260_vm │ │ │ ├── 1261 │ │ │ ├── 1261_fsm │ │ │ ├── 1261_vm │ │ │ ├── 1262 │ │ │ ├── 1262_fsm │ │ │ ├── 1262_vm │ │ │ ├── 2396 │ │ │ ├── 2396_fsm │ │ │ ├── 2396_vm │ │ │ ├── 2397 │ │ │ ├── 2671 │ │ │ ├── 2672 │ │ │ ├── 2676 │ │ │ ├── 2677 │ │ │ ├── 2694 │ │ │ ├── 2695 │ │ │ ├── 2697 │ │ │ ├── 2698 │ │ │ ├── 2846 │ │ │ ├── 2847 │ │ │ ├── 2964 │ │ │ ├── 2965 │ │ │ ├── 2966 │ │ │ ├── 2967 │ │ │ ├── 3592 │ │ │ ├── 3593 │ │ │ ├── 4060 │ │ │ ├── 4061 │ │ │ ├── 4175 │ │ │ ├── 4176 │ │ │ ├── 4177 │ │ │ ├── 4178 │ │ │ ├── 4181 │ │ │ ├── 4182 │ │ │ ├── 4183 │ │ │ ├── 4184 │ │ │ ├── 4185 │ │ │ ├── 4186 │ │ │ ├── 6000 │ │ │ ├── 6001 │ │ │ ├── 6002 │ │ │ ├── 6100 │ │ │ ├── 6114 │ │ │ ├── 6115 │ │ │ ├── pg_control │ │ │ └── pg_internal.init │ │ ├── pg_hba.conf │ │ ├── pg_ident.conf │ │ ├── pg_logical/ │ │ │ └── replorigin_checkpoint │ │ ├── pg_multixact/ │ │ │ ├── members/ │ │ │ │ └── 0000 │ │ │ └── offsets/ │ │ │ └── 0000 │ │ ├── pg_stat_tmp/ │ │ │ ├── db_0.stat │ │ │ ├── db_13395.stat │ │ │ └── global.stat │ │ ├── pg_subtrans/ │ │ │ └── 0000 │ │ ├── pg_wal/ │ │ │ └── 000000010000000000000001 │ │ ├── pg_xact/ │ │ │ └── 0000 │ │ ├── postgresql.auto.conf │ │ ├── postgresql.conf │ │ ├── postmaster.opts │ │ └── postmaster.pid │ ├── db.sqlite3 │ ├── docker-compose.yml │ ├── manage.py │ ├── newapp/ │ │ ├── __init__.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── migrations/ │ │ │ └── __init__.py │ │ └── tasks.py │ ├── req.txt │ └── requirements.txt ├── Part-5 Dockerize a React Application/ │ └── core/ │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── commands.txt │ ├── docker-compose.yml │ ├── package.json │ ├── public/ │ │ ├── index.html │ │ ├── manifest.json │ │ └── robots.txt │ ├── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── index.css │ │ ├── index.js │ │ ├── reportWebVitals.js │ │ └── setupTests.js │ └── text.txt ├── Part-6 Nginx React and Django Gunicorn/ │ ├── Final/ │ │ ├── commands.txt │ │ ├── django/ │ │ │ ├── .coverage │ │ │ ├── .dockerignore │ │ │ ├── Dockerfile │ │ │ ├── blog/ │ │ │ │ ├── __init__.py │ │ │ │ ├── admin.py │ │ │ │ ├── apps.py │ │ │ │ ├── migrations/ │ │ │ │ │ ├── 0001_initial.py │ │ │ │ │ └── __init__.py │ │ │ │ ├── models.py │ │ │ │ ├── tests.py │ │ │ │ └── urls.py │ │ │ ├── blog_api/ │ │ │ │ ├── __init__.py │ │ │ │ ├── admin.py │ │ │ │ ├── apps.py │ │ │ │ ├── migrations/ │ │ │ │ │ └── __init__.py │ │ │ │ ├── models.py │ │ │ │ ├── serializers.py │ │ │ │ ├── tests.py │ │ │ │ ├── urls.py │ │ │ │ └── views.py │ │ │ ├── commands.txt │ │ │ ├── core/ │ │ │ │ ├── __init__.py │ │ │ │ ├── asgi.py │ │ │ │ ├── settings.py │ │ │ │ ├── urls.py │ │ │ │ └── wsgi.py │ │ │ ├── db.sqlite3 │ │ │ ├── htmlcov/ │ │ │ │ ├── blog___init___py.html │ │ │ │ ├── blog_admin_py.html │ │ │ │ ├── blog_api___init___py.html │ │ │ │ ├── blog_api_admin_py.html │ │ │ │ ├── blog_api_migrations___init___py.html │ │ │ │ ├── blog_api_models_py.html │ │ │ │ ├── blog_api_serializers_py.html │ │ │ │ ├── blog_api_tests_py.html │ │ │ │ ├── blog_api_urls_py.html │ │ │ │ ├── blog_api_views_py.html │ │ │ │ ├── blog_migrations_0001_initial_py.html │ │ │ │ ├── blog_migrations___init___py.html │ │ │ │ ├── blog_models_py.html │ │ │ │ ├── blog_tests_py.html │ │ │ │ ├── blog_urls_py.html │ │ │ │ ├── core___init___py.html │ │ │ │ ├── core_settings_py.html │ │ │ │ ├── core_urls_py.html │ │ │ │ ├── coverage_html.js │ │ │ │ ├── index.html │ │ │ │ ├── jquery.hotkeys.js │ │ │ │ ├── jquery.isonscreen.js │ │ │ │ ├── manage_py.html │ │ │ │ ├── status.json │ │ │ │ └── style.css │ │ │ ├── manage.py │ │ │ ├── requirements.txt │ │ │ └── templates/ │ │ │ └── blog/ │ │ │ └── index.html │ │ ├── docker-compose.yml │ │ ├── nginx/ │ │ │ └── nginx-setup.conf │ │ └── react/ │ │ └── blogapi/ │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ ├── manifest.json │ │ │ └── robots.txt │ │ └── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── components/ │ │ │ ├── Footer.js │ │ │ ├── Header.js │ │ │ ├── PostLoading.js │ │ │ └── Posts.js │ │ ├── index.css │ │ ├── index.js │ │ ├── serviceWorker.js │ │ └── setupTests.js │ └── Starting Repository/ │ ├── .gitattributes │ ├── django/ │ │ ├── .coverage │ │ ├── blog/ │ │ │ ├── __init__.py │ │ │ ├── admin.py │ │ │ ├── apps.py │ │ │ ├── migrations/ │ │ │ │ ├── 0001_initial.py │ │ │ │ └── __init__.py │ │ │ ├── models.py │ │ │ ├── tests.py │ │ │ └── urls.py │ │ ├── blog_api/ │ │ │ ├── __init__.py │ │ │ ├── admin.py │ │ │ ├── apps.py │ │ │ ├── migrations/ │ │ │ │ └── __init__.py │ │ │ ├── models.py │ │ │ ├── serializers.py │ │ │ ├── tests.py │ │ │ ├── urls.py │ │ │ └── views.py │ │ ├── commands.txt │ │ ├── core/ │ │ │ ├── __init__.py │ │ │ ├── asgi.py │ │ │ ├── settings.py │ │ │ ├── urls.py │ │ │ └── wsgi.py │ │ ├── db.sqlite3 │ │ ├── htmlcov/ │ │ │ ├── blog___init___py.html │ │ │ ├── blog_admin_py.html │ │ │ ├── blog_api___init___py.html │ │ │ ├── blog_api_admin_py.html │ │ │ ├── blog_api_migrations___init___py.html │ │ │ ├── blog_api_models_py.html │ │ │ ├── blog_api_serializers_py.html │ │ │ ├── blog_api_tests_py.html │ │ │ ├── blog_api_urls_py.html │ │ │ ├── blog_api_views_py.html │ │ │ ├── blog_migrations_0001_initial_py.html │ │ │ ├── blog_migrations___init___py.html │ │ │ ├── blog_models_py.html │ │ │ ├── blog_tests_py.html │ │ │ ├── blog_urls_py.html │ │ │ ├── core___init___py.html │ │ │ ├── core_settings_py.html │ │ │ ├── core_urls_py.html │ │ │ ├── coverage_html.js │ │ │ ├── index.html │ │ │ ├── jquery.hotkeys.js │ │ │ ├── jquery.isonscreen.js │ │ │ ├── manage_py.html │ │ │ ├── status.json │ │ │ └── style.css │ │ ├── manage.py │ │ ├── requirements.txt │ │ └── templates/ │ │ └── blog/ │ │ └── index.html │ └── react/ │ ├── blogapi/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ ├── manifest.json │ │ │ └── robots.txt │ │ └── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── components/ │ │ │ ├── Footer.js │ │ │ ├── Header.js │ │ │ ├── PostLoading.js │ │ │ └── Posts.js │ │ ├── index.css │ │ ├── index.js │ │ ├── serviceWorker.js │ │ └── setupTests.js │ └── commands.txt └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ # Auto detect text files and perform LF normalization * text=auto ================================================ FILE: .gitignore ================================================ .DS_Store ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2021 Very Academy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/README.md ================================================ # YT-Django-Celery-Series-Intro-Install-Run-Task ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/__init__.py ================================================ ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/admin.py ================================================ from django.contrib import admin # Register your models here. ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/apps.py ================================================ from django.apps import AppConfig class App1Config(AppConfig): name = 'app1' ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/migrations/__init__.py ================================================ ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/models.py ================================================ from django.db import models # Create your models here. ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/tasks.py ================================================ from __future__ import absolute_import, unicode_literals from celery import shared_task @shared_task def add(x, y): return x + y ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/tests.py ================================================ from django.test import TestCase # Create your tests here. ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/app1/views.py ================================================ from django.shortcuts import render # Create your views here. ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/command.txt ================================================ Commands Used ################ # Install celery pip install celery # Install RabbitMQ (Ubuntu Linux 20.04LTS) sudo apt-get install rabbitmq-server # Run Celery celery -A NAMEOFINSTANCE worker --loglevel=info we used celery -A proj worker --loglevel=info (If on Windows) celery -A proj worker -l info --pool=solo #Run Task py manage.py shell from app1.tasks import add add.delay(2,2) docker run -d --hostname my-rabbit --name some-rabbit -p 5672:5672 -p 8080:15672 rabbitmq:3-management ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/manage.py ================================================ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/proj/__init__.py ================================================ ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/proj/asgi.py ================================================ """ ASGI config for proj project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings') application = get_asgi_application() ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/proj/celery.py ================================================ from __future__ import absolute_import, unicode_literals import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings') app = Celery('proj') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/proj/settings.py ================================================ """ Django settings for proj project. Generated by 'django-admin startproject' using Django 3.1. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve(strict=True).parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'sqehio$00h@b5$t3!@a*e@opjdync*rx409oemuukramxywqa3' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'app1' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'proj.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'proj.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' CELERY_BROKER_URL = 'amqp://localhost' ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/proj/urls.py ================================================ """proj URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), ] ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/proj/wsgi.py ================================================ """ WSGI config for proj project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings') application = get_wsgi_application() ================================================ FILE: Part-07 RabbitMQ with Celery Quick Start Guide/requirements.txt ================================================ amqp==5.0.6 asgiref==3.3.4 billiard==3.6.4.0 celery==5.0.5 click==7.1.2 click-didyoumean==0.0.3 click-plugins==1.1.1 click-repl==0.1.6 Django==3.2 kombu==5.0.2 prompt-toolkit==3.0.18 pytz==2021.1 six==1.15.0 sqlparse==0.4.1 vine==5.0.0 wcwidth==0.2.5 ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/commands.txt ================================================ docker-compose up docker ps docker inspect xyz pip install psycopg2 pip freeze > requirements.txt ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/core/__init__.py ================================================ ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/core/asgi.py ================================================ """ ASGI config for core project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_asgi_application() ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/core/settings.py ================================================ """ Django settings for core project. Generated by 'django-admin startproject' using Django 3.2.2. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-#=rdn+&p#+#o@+pdy%uf-icgxm)5e)n2ujop&c6vm#y#m-1r0s' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'core.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'core.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases # DATABASES = { # 'default': { # 'ENGINE': 'django.db.backends.sqlite3', # 'NAME': BASE_DIR / 'db.sqlite3', # } # } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'test_db', 'USER': 'root', 'PASSWORD': 'root', 'HOST': '127.0.0.1', 'PORT': '5432', } } # Password validation # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = '/static/' # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/core/urls.py ================================================ """core URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), ] ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/core/wsgi.py ================================================ """ WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_wsgi_application() ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/docker-compose.yml ================================================ version: '3.1' services: db: container_name: postgresql_db image: postgres # automatically restarts the container - Docker daemon on restart or # the container itself is manually restarted restart: always volumes: - ./data/db:/var/lib/postgresql/data environment: POSTGRES_USER: root POSTGRES_PASSWORD: root POSTGRES_DB: test_db ports: - "5432:5432" networks: app_net: ipv4_address: 192.168.0.2 pgadmin: container_name: pgadmin4 image: dpage/pgadmin4 restart: always volumes: - ./data/pgadmin-data:/var/lib/pgadmin environment: PGADMIN_DEFAULT_EMAIL: root@root.com PGADMIN_DEFAULT_PASSWORD: root # PGADMIN_LISTEN_PORT = 80 ports: - "5050:80" networks: app_net: ipv4_address: 192.168.0.3 networks: app_net: ipam: driver: default config: - subnet: "192.168.0.0/24" gateway: 192.168.0.1 ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/manage.py ================================================ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() ================================================ FILE: Part-08 PostgreSQL with pgAdmin and Custom Network Config/requirements.txt ================================================ asgiref==3.3.4 Django==3.2.2 psycopg2==2.8.6 pytz==2021.1 sqlparse==0.4.1 ================================================ FILE: Part-1 Dockerize a Django Application/Dockerfile ================================================ FROM python:3.8-slim-buster WORKDIR /app COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt COPY . . CMD [ "python3", "manage.py", "runserver", "0.0.0.0:8000"] ================================================ FILE: Part-1 Dockerize a Django Application/commands.txt ================================================ docker build --tag python-django . docker run --publish 8000:8000 python-django ================================================ FILE: Part-1 Dockerize a Django Application/core/__init__.py ================================================ ================================================ FILE: Part-1 Dockerize a Django Application/core/asgi.py ================================================ """ ASGI config for core project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_asgi_application() ================================================ FILE: Part-1 Dockerize a Django Application/core/settings.py ================================================ """ Django settings for core project. Generated by 'django-admin startproject' using Django 3.1.7. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'fz6+lw%5*b^&j8&wz5vb-xi-+2^$klpagds6r(cag^8*@xno83' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'core' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'core.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'core.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' ================================================ FILE: Part-1 Dockerize a Django Application/core/templates/index.html ================================================ Hello Docker ================================================ FILE: Part-1 Dockerize a Django Application/core/urls.py ================================================ """core URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.home) ] ================================================ FILE: Part-1 Dockerize a Django Application/core/views.py ================================================ from django.shortcuts import render def home(request): return render(request, 'index.html') ================================================ FILE: Part-1 Dockerize a Django Application/core/wsgi.py ================================================ """ WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_wsgi_application() ================================================ FILE: Part-1 Dockerize a Django Application/db.sqlite3 ================================================ ================================================ FILE: Part-1 Dockerize a Django Application/dockerignore ================================================ venv ================================================ FILE: Part-1 Dockerize a Django Application/manage.py ================================================ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() ================================================ FILE: Part-1 Dockerize a Django Application/requirements.txt ================================================ asgiref==3.3.1 Django==3.1.7 pytz==2021.1 sqlparse==0.4.1 ================================================ FILE: Part-2 Build and Start Django in a Container/Dockerfile ================================================ FROM python:3.8-slim-buster ENV PYTHONUNBUFFERED=1 WORKDIR /django COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt ================================================ FILE: Part-2 Build and Start Django in a Container/commands.txt ================================================ Part#1 docker build --tag python-django . docker run --publish 8000:8000 python-django Part#2 docker-compose build docker-compose run --rm app django-admin startproject core. docker-compose up ================================================ FILE: Part-2 Build and Start Django in a Container/core/__init__.py ================================================ ================================================ FILE: Part-2 Build and Start Django in a Container/core/asgi.py ================================================ """ ASGI config for core project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_asgi_application() ================================================ FILE: Part-2 Build and Start Django in a Container/core/settings.py ================================================ """ Django settings for core project. Generated by 'django-admin startproject' using Django 3.1.7. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'jt-qh9v4+)+4e@3wa05@4pbkw@f$97rzyezckbn6v$67jcqu-b' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'core' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'core.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'core.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' ================================================ FILE: Part-2 Build and Start Django in a Container/core/templates/index.html ================================================ Hello Docker ================================================ FILE: Part-2 Build and Start Django in a Container/core/urls.py ================================================ from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.home) ] ================================================ FILE: Part-2 Build and Start Django in a Container/core/views.py ================================================ from django.shortcuts import render def home(request): return render(request, 'index.html') ================================================ FILE: Part-2 Build and Start Django in a Container/core/wsgi.py ================================================ """ WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_wsgi_application() ================================================ FILE: Part-2 Build and Start Django in a Container/db.sqlite3 ================================================ ================================================ FILE: Part-2 Build and Start Django in a Container/docker-compose.yml ================================================ version: "3.8" services: app: build: . volumes: - .:/django ports: - 8000:8000 image: app:django container_name: django_container command: python manage.py runserver 0.0.0.0:8000 ================================================ FILE: Part-2 Build and Start Django in a Container/manage.py ================================================ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() ================================================ FILE: Part-2 Build and Start Django in a Container/requirements.txt ================================================ asgiref==3.3.1 Django==3.1.7 pytz==2021.1 sqlparse==0.4.1 ================================================ FILE: Part-3 Containerize Postgres or MySQL/Dockerfile ================================================ FROM python:3.8 ENV PYTHONUNBUFFERED=1 WORKDIR /django COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt ================================================ FILE: Part-3 Containerize Postgres or MySQL/commands.txt ================================================ Part#1 docker build --tag python-django . docker run --publish 8000:8000 python-django Part#2 docker-compose build docker-compose run --rm app django-admin startproject core . docker-compose up Part#3 docker-compose build docker-compose run --rm app django-admin startproject core . docker-compose up docker exec -it django_container /bin/bash ================================================ FILE: Part-3 Containerize Postgres or MySQL/core/__init__.py ================================================ ================================================ FILE: Part-3 Containerize Postgres or MySQL/core/asgi.py ================================================ """ ASGI config for core project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_asgi_application() ================================================ FILE: Part-3 Containerize Postgres or MySQL/core/settings.py ================================================ """ Django settings for core project. Generated by 'django-admin startproject' using Django 3.1.7. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 't^!+3uz%cbs$xu!qpe=6&%h^#$ydrps5=r8u_qwe!lsp4-c74e' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'core.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'core.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases # DATABASES = { # 'default': { # 'ENGINE': 'django.db.backends.postgresql', # 'NAME': 'postgres', # 'USER': 'postgres', # 'PASSWORD': 'postgres', # 'HOST': 'db', # 'PORT': 5432, # } # } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'django-app-db', 'USER': 'root', 'PASSWORD': '', 'HOST': 'db', 'PORT': '3306', } } # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' ================================================ FILE: Part-3 Containerize Postgres or MySQL/core/urls.py ================================================ """core URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), ] ================================================ FILE: Part-3 Containerize Postgres or MySQL/core/wsgi.py ================================================ """ WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_wsgi_application() ================================================ FILE: Part-3 Containerize Postgres or MySQL/docker-compose.yml ================================================ version: "3.8" services: app: build: . volumes: - .:/django ports: - 8000:8000 image: app:django container_name: django_container command: python manage.py runserver 0.0.0.0:8000 depends_on: - db db: # image: postgres # volumes: # - ./data/db:/var/lib/postgresql/data # environment: # - POSTGRES_DB=postgres # - POSTGRES_USER=postgres # - POSTGRES_PASSWORD=postgres # container_name: postgres_db image: mysql:5.7 environment: MYSQL_DATABASE: 'django-app-db' MYSQL_ALLOW_EMPTY_PASSWORD: 'true' volumes: - ./data/mysql/db:/var/lib/mysql ================================================ FILE: Part-3 Containerize Postgres or MySQL/manage.py ================================================ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() ================================================ FILE: Part-3 Containerize Postgres or MySQL/requirements.txt ================================================ asgiref==3.3.1 Django==3.1.7 pytz==2021.1 sqlparse==0.4.1 psycopg2-binary>=2.8 mysqlclient>=2.0 ================================================ FILE: Part-4 Django Postgres Redis and Celery/Dockerfile ================================================ FROM python:3.8-alpine ENV PYTHONUNBUFFERED=1 RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev WORKDIR /django COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt ================================================ FILE: Part-4 Django Postgres Redis and Celery/commands.txt ================================================ Part#1 docker build --tag python-django . docker run --publish 8000:8000 python-django Part#2 docker-compose build docker-compose run --rm app django-admin startproject core . docker-compose up Part#3 docker-compose build docker-compose run --rm app django-admin startproject core . docker-compose up docker exec -it django_container /bin/bash Part#4 docker-compose run django_app sh -c "django-admin startapp newapp ." docker exec -it django_app sh #Run Celery Task python manage.py shell from newapp.tasks import add add.delay(2, 2) Info: PYTHONUNBUFFERED: Setting the non-empty value of PYTHONUNBUFFERED means that the python output is transmitted directly to the terminal without being buffered and that allows displaying the application’s output in real-time. ================================================ FILE: Part-4 Django Postgres Redis and Celery/core/__init__.py ================================================ from __future__ import absolute_import, unicode_literals # This will make sure the app is always imported when # Django starts so that shared_task will use this app. from .celery import app as celery_app __all__ = ('celery_app',) ================================================ FILE: Part-4 Django Postgres Redis and Celery/core/asgi.py ================================================ """ ASGI config for core project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_asgi_application() ================================================ FILE: Part-4 Django Postgres Redis and Celery/core/celery.py ================================================ import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') app = Celery('core') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() ================================================ FILE: Part-4 Django Postgres Redis and Celery/core/settings.py ================================================ """ Django settings for core project. Generated by 'django-admin startproject' using Django 3.1.7. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'q&oh8d*y@!ir(bs88&hao2*$g-!0(kn*bh3uh)7v%(wa1s%zc#' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'newapp' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'core.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'core.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' CELERY_BROKER_URL = "redis://redis:6379" CELERY_RESULT_BACKEND = "redis://redis:6379" ================================================ FILE: Part-4 Django Postgres Redis and Celery/core/urls.py ================================================ """core URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), ] ================================================ FILE: Part-4 Django Postgres Redis and Celery/core/wsgi.py ================================================ """ WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_wsgi_application() ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/PG_VERSION ================================================ 13 ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/13247 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/13252 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/13257 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/13262 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/1417 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/1418 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2224 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2328 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2336 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2604 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2611 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2613 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2620 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2830 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2832 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2834 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2836 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/2995 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3118 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3256 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3350 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3381 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3429 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3430 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3439 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3466 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3501 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3576 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3596 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/3598 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4143 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4145 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4147 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4149 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4151 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4153 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4155 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4157 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4159 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4161 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4163 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4165 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4167 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4169 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4171 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/4173 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/6102 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/6104 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/6106 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/826 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/1/PG_VERSION ================================================ 13 ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/13247 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/13252 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/13257 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/13262 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/1417 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/1418 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2224 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2328 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2336 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2604 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2611 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2613 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2620 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2830 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2832 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2834 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2836 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/2995 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3118 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3256 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3350 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3381 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3429 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3430 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3439 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3466 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3501 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3576 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3596 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/3598 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4143 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4145 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4147 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4149 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4151 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4153 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4155 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4157 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4159 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4161 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4163 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4165 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4167 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4169 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4171 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/4173 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/6102 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/6104 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/6106 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/826 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13394/PG_VERSION ================================================ 13 ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/13247 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/13252 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/13257 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/13262 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/1417 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/1418 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2224 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2328 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2336 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2604 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2611 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2613 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2620 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2830 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2832 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2834 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2836 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/2995 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3118 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3256 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3350 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3381 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3429 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3430 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3439 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3466 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3501 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3576 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3596 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/3598 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4143 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4145 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4147 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4149 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4151 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4153 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4155 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4157 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4159 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4161 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4163 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4165 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4167 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4169 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4171 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/4173 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/6102 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/6104 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/6106 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/826 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/base/13395/PG_VERSION ================================================ 13 ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/2846 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/2964 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/2966 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/3592 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/4060 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/4175 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/4177 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/4181 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/4183 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/4185 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/6000 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/global/6100 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/pg_hba.conf ================================================ # PostgreSQL Client Authentication Configuration File # =================================================== # # Refer to the "Client Authentication" section in the PostgreSQL # documentation for a complete description of this file. A short # synopsis follows. # # This file controls: which hosts are allowed to connect, how clients # are authenticated, which PostgreSQL user names they can use, which # databases they can access. Records take one of these forms: # # local DATABASE USER METHOD [OPTIONS] # host DATABASE USER ADDRESS METHOD [OPTIONS] # hostssl DATABASE USER ADDRESS METHOD [OPTIONS] # hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] # hostgssenc DATABASE USER ADDRESS METHOD [OPTIONS] # hostnogssenc DATABASE USER ADDRESS METHOD [OPTIONS] # # (The uppercase items must be replaced by actual values.) # # The first field is the connection type: "local" is a Unix-domain # socket, "host" is either a plain or SSL-encrypted TCP/IP socket, # "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a # non-SSL TCP/IP socket. Similarly, "hostgssenc" uses a # GSSAPI-encrypted TCP/IP socket, while "hostnogssenc" uses a # non-GSSAPI socket. # # DATABASE can be "all", "sameuser", "samerole", "replication", a # database name, or a comma-separated list thereof. The "all" # keyword does not match "replication". Access to replication # must be enabled in a separate record (see example below). # # USER can be "all", a user name, a group name prefixed with "+", or a # comma-separated list thereof. In both the DATABASE and USER fields # you can also write a file name prefixed with "@" to include names # from a separate file. # # ADDRESS specifies the set of hosts the record matches. It can be a # host name, or it is made up of an IP address and a CIDR mask that is # an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that # specifies the number of significant bits in the mask. A host name # that starts with a dot (.) matches a suffix of the actual host name. # Alternatively, you can write an IP address and netmask in separate # columns to specify the set of hosts. Instead of a CIDR-address, you # can write "samehost" to match any of the server's own IP addresses, # or "samenet" to match any address in any subnet that the server is # directly connected to. # # METHOD can be "trust", "reject", "md5", "password", "scram-sha-256", # "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert". # Note that "password" sends passwords in clear text; "md5" or # "scram-sha-256" are preferred since they send encrypted passwords. # # OPTIONS are a set of options for the authentication in the format # NAME=VALUE. The available options depend on the different # authentication methods -- refer to the "Client Authentication" # section in the documentation for a list of which options are # available for which authentication methods. # # Database and user names containing spaces, commas, quotes and other # special characters must be quoted. Quoting one of the keywords # "all", "sameuser", "samerole" or "replication" makes the name lose # its special character, and just match a database or username with # that name. # # This file is read on server startup and when the server receives a # SIGHUP signal. If you edit the file on a running system, you have to # SIGHUP the server for the changes to take effect, run "pg_ctl reload", # or execute "SELECT pg_reload_conf()". # # Put your actual configuration here # ---------------------------------- # # If you want to allow non-local connections, you need to add more # "host" records. In that case you will also need to make PostgreSQL # listen on a non-local interface via the listen_addresses # configuration parameter, or via the -i or -h command line switches. # CAUTION: Configuring the system for local "trust" authentication # allows any local user to connect as any PostgreSQL user, including # the database superuser. If you do not trust all your local users, # use another authentication method. # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust # Allow replication connections from localhost, by a user with the # replication privilege. local replication all trust host replication all 127.0.0.1/32 trust host replication all ::1/128 trust host all all all md5 ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/pg_ident.conf ================================================ # PostgreSQL User Name Maps # ========================= # # Refer to the PostgreSQL documentation, chapter "Client # Authentication" for a complete description. A short synopsis # follows. # # This file controls PostgreSQL user name mapping. It maps external # user names to their corresponding PostgreSQL user names. Records # are of the form: # # MAPNAME SYSTEM-USERNAME PG-USERNAME # # (The uppercase quantities must be replaced by actual values.) # # MAPNAME is the (otherwise freely chosen) map name that was used in # pg_hba.conf. SYSTEM-USERNAME is the detected user name of the # client. PG-USERNAME is the requested PostgreSQL user name. The # existence of a record specifies that SYSTEM-USERNAME may connect as # PG-USERNAME. # # If SYSTEM-USERNAME starts with a slash (/), it will be treated as a # regular expression. Optionally this can contain a capture (a # parenthesized subexpression). The substring matching the capture # will be substituted for \1 (backslash-one) if present in # PG-USERNAME. # # Multiple maps may be specified in this file and used by pg_hba.conf. # # No map names are defined in the default configuration. If all # system user names and PostgreSQL user names are the same, you don't # need anything in this file. # # This file is read on server startup and when the postmaster receives # a SIGHUP signal. If you edit the file on a running system, you have # to SIGHUP the postmaster for the changes to take effect. You can # use "pg_ctl reload" to do that. # Put your actual configuration here # ---------------------------------- # MAPNAME SYSTEM-USERNAME PG-USERNAME ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/pg_wal/000000010000000000000001 ================================================ [File too large to display: 16.0 MB] ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/postgresql.auto.conf ================================================ # Do not edit this file manually! # It will be overwritten by the ALTER SYSTEM command. ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/postgresql.conf ================================================ # ----------------------------- # PostgreSQL configuration file # ----------------------------- # # This file consists of lines of the form: # # name = value # # (The "=" is optional.) Whitespace may be used. Comments are introduced with # "#" anywhere on a line. The complete list of parameter names and allowed # values can be found in the PostgreSQL documentation. # # The commented-out settings shown in this file represent the default values. # Re-commenting a setting is NOT sufficient to revert it to the default value; # you need to reload the server. # # This file is read on server startup and when the server receives a SIGHUP # signal. If you edit the file on a running system, you have to SIGHUP the # server for the changes to take effect, run "pg_ctl reload", or execute # "SELECT pg_reload_conf()". Some parameters, which are marked below, # require a server shutdown and restart to take effect. # # Any parameter can also be given as a command-line option to the server, e.g., # "postgres -c log_connections=on". Some parameters can be changed at run time # with the "SET" SQL command. # # Memory units: kB = kilobytes Time units: ms = milliseconds # MB = megabytes s = seconds # GB = gigabytes min = minutes # TB = terabytes h = hours # d = days #------------------------------------------------------------------------------ # FILE LOCATIONS #------------------------------------------------------------------------------ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. #data_directory = 'ConfigDir' # use data in another directory # (change requires restart) #hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file # (change requires restart) #ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file # (change requires restart) # If external_pid_file is not explicitly set, no extra PID file is written. #external_pid_file = '' # write an extra PID file # (change requires restart) #------------------------------------------------------------------------------ # CONNECTIONS AND AUTHENTICATION #------------------------------------------------------------------------------ # - Connection Settings - listen_addresses = '*' # comma-separated list of addresses; # defaults to 'localhost'; use '*' for all # (change requires restart) #port = 5432 # (change requires restart) max_connections = 100 # (change requires restart) #superuser_reserved_connections = 3 # (change requires restart) #unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories # (change requires restart) #unix_socket_group = '' # (change requires restart) #unix_socket_permissions = 0777 # begin with 0 to use octal notation # (change requires restart) #bonjour = off # advertise server via Bonjour # (change requires restart) #bonjour_name = '' # defaults to the computer name # (change requires restart) # - TCP settings - # see "man tcp" for details #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; # 0 selects the system default #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; # 0 selects the system default #tcp_keepalives_count = 0 # TCP_KEEPCNT; # 0 selects the system default #tcp_user_timeout = 0 # TCP_USER_TIMEOUT, in milliseconds; # 0 selects the system default # - Authentication - #authentication_timeout = 1min # 1s-600s #password_encryption = md5 # md5 or scram-sha-256 #db_user_namespace = off # GSSAPI using Kerberos #krb_server_keyfile = 'FILE:${sysconfdir}/krb5.keytab' #krb_caseins_users = off # - SSL - #ssl = off #ssl_ca_file = '' #ssl_cert_file = 'server.crt' #ssl_crl_file = '' #ssl_key_file = 'server.key' #ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers #ssl_prefer_server_ciphers = on #ssl_ecdh_curve = 'prime256v1' #ssl_min_protocol_version = 'TLSv1.2' #ssl_max_protocol_version = '' #ssl_dh_params_file = '' #ssl_passphrase_command = '' #ssl_passphrase_command_supports_reload = off #------------------------------------------------------------------------------ # RESOURCE USAGE (except WAL) #------------------------------------------------------------------------------ # - Memory - shared_buffers = 128MB # min 128kB # (change requires restart) #huge_pages = try # on, off, or try # (change requires restart) #temp_buffers = 8MB # min 800kB #max_prepared_transactions = 0 # zero disables the feature # (change requires restart) # Caution: it is not advisable to set max_prepared_transactions nonzero unless # you actively intend to use prepared transactions. #work_mem = 4MB # min 64kB #hash_mem_multiplier = 1.0 # 1-1000.0 multiplier on hash table work_mem #maintenance_work_mem = 64MB # min 1MB #autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem #logical_decoding_work_mem = 64MB # min 64kB #max_stack_depth = 2MB # min 100kB #shared_memory_type = mmap # the default is the first option # supported by the operating system: # mmap # sysv # windows # (change requires restart) dynamic_shared_memory_type = posix # the default is the first option # supported by the operating system: # posix # sysv # windows # mmap # (change requires restart) # - Disk - #temp_file_limit = -1 # limits per-process temp file space # in kilobytes, or -1 for no limit # - Kernel Resources - #max_files_per_process = 1000 # min 64 # (change requires restart) # - Cost-Based Vacuum Delay - #vacuum_cost_delay = 0 # 0-100 milliseconds (0 disables) #vacuum_cost_page_hit = 1 # 0-10000 credits #vacuum_cost_page_miss = 10 # 0-10000 credits #vacuum_cost_page_dirty = 20 # 0-10000 credits #vacuum_cost_limit = 200 # 1-10000 credits # - Background Writer - #bgwriter_delay = 200ms # 10-10000ms between rounds #bgwriter_lru_maxpages = 100 # max buffers written/round, 0 disables #bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round #bgwriter_flush_after = 512kB # measured in pages, 0 disables # - Asynchronous Behavior - #effective_io_concurrency = 1 # 1-1000; 0 disables prefetching #maintenance_io_concurrency = 10 # 1-1000; 0 disables prefetching #max_worker_processes = 8 # (change requires restart) #max_parallel_maintenance_workers = 2 # taken from max_parallel_workers #max_parallel_workers_per_gather = 2 # taken from max_parallel_workers #parallel_leader_participation = on #max_parallel_workers = 8 # maximum number of max_worker_processes that # can be used in parallel operations #old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate # (change requires restart) #backend_flush_after = 0 # measured in pages, 0 disables #------------------------------------------------------------------------------ # WRITE-AHEAD LOG #------------------------------------------------------------------------------ # - Settings - #wal_level = replica # minimal, replica, or logical # (change requires restart) #fsync = on # flush data to disk for crash safety # (turning this off can cause # unrecoverable data corruption) #synchronous_commit = on # synchronization level; # off, local, remote_write, remote_apply, or on #wal_sync_method = fsync # the default is the first option # supported by the operating system: # open_datasync # fdatasync (default on Linux) # fsync # fsync_writethrough # open_sync #full_page_writes = on # recover from partial page writes #wal_compression = off # enable compression of full-page writes #wal_log_hints = off # also do full page writes of non-critical updates # (change requires restart) #wal_init_zero = on # zero-fill new WAL files #wal_recycle = on # recycle WAL files #wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers # (change requires restart) #wal_writer_delay = 200ms # 1-10000 milliseconds #wal_writer_flush_after = 1MB # measured in pages, 0 disables #wal_skip_threshold = 2MB #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 # - Checkpoints - #checkpoint_timeout = 5min # range 30s-1d max_wal_size = 1GB min_wal_size = 80MB #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 #checkpoint_flush_after = 256kB # measured in pages, 0 disables #checkpoint_warning = 30s # 0 disables # - Archiving - #archive_mode = off # enables archiving; off, on, or always # (change requires restart) #archive_command = '' # command to use to archive a logfile segment # placeholders: %p = path of file to archive # %f = file name only # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f' #archive_timeout = 0 # force a logfile segment switch after this # number of seconds; 0 disables # - Archive Recovery - # These are only used in recovery mode. #restore_command = '' # command to use to restore an archived logfile segment # placeholders: %p = path of file to restore # %f = file name only # e.g. 'cp /mnt/server/archivedir/%f %p' # (change requires restart) #archive_cleanup_command = '' # command to execute at every restartpoint #recovery_end_command = '' # command to execute at completion of recovery # - Recovery Target - # Set these only when performing a targeted recovery. #recovery_target = '' # 'immediate' to end recovery as soon as a # consistent state is reached # (change requires restart) #recovery_target_name = '' # the named restore point to which recovery will proceed # (change requires restart) #recovery_target_time = '' # the time stamp up to which recovery will proceed # (change requires restart) #recovery_target_xid = '' # the transaction ID up to which recovery will proceed # (change requires restart) #recovery_target_lsn = '' # the WAL LSN up to which recovery will proceed # (change requires restart) #recovery_target_inclusive = on # Specifies whether to stop: # just after the specified recovery target (on) # just before the recovery target (off) # (change requires restart) #recovery_target_timeline = 'latest' # 'current', 'latest', or timeline ID # (change requires restart) #recovery_target_action = 'pause' # 'pause', 'promote', 'shutdown' # (change requires restart) #------------------------------------------------------------------------------ # REPLICATION #------------------------------------------------------------------------------ # - Sending Servers - # Set these on the master and on any standby that will send replication data. #max_wal_senders = 10 # max number of walsender processes # (change requires restart) #wal_keep_size = 0 # in megabytes; 0 disables #max_slot_wal_keep_size = -1 # in megabytes; -1 disables #wal_sender_timeout = 60s # in milliseconds; 0 disables #max_replication_slots = 10 # max number of replication slots # (change requires restart) #track_commit_timestamp = off # collect timestamp of transaction commit # (change requires restart) # - Master Server - # These settings are ignored on a standby server. #synchronous_standby_names = '' # standby servers that provide sync rep # method to choose sync standbys, number of sync standbys, # and comma-separated list of application_name # from standby(s); '*' = all #vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed # - Standby Servers - # These settings are ignored on a master server. #primary_conninfo = '' # connection string to sending server #primary_slot_name = '' # replication slot on sending server #promote_trigger_file = '' # file name whose presence ends recovery #hot_standby = on # "off" disallows queries during recovery # (change requires restart) #max_standby_archive_delay = 30s # max delay before canceling queries # when reading WAL from archive; # -1 allows indefinite delay #max_standby_streaming_delay = 30s # max delay before canceling queries # when reading streaming WAL; # -1 allows indefinite delay #wal_receiver_create_temp_slot = off # create temp slot if primary_slot_name # is not set #wal_receiver_status_interval = 10s # send replies at least this often # 0 disables #hot_standby_feedback = off # send info from standby to prevent # query conflicts #wal_receiver_timeout = 60s # time that receiver waits for # communication from master # in milliseconds; 0 disables #wal_retrieve_retry_interval = 5s # time to wait before retrying to # retrieve WAL after a failed attempt #recovery_min_apply_delay = 0 # minimum delay for applying changes during recovery # - Subscribers - # These settings are ignored on a publisher. #max_logical_replication_workers = 4 # taken from max_worker_processes # (change requires restart) #max_sync_workers_per_subscription = 2 # taken from max_logical_replication_workers #------------------------------------------------------------------------------ # QUERY TUNING #------------------------------------------------------------------------------ # - Planner Method Configuration - #enable_bitmapscan = on #enable_hashagg = on #enable_hashjoin = on #enable_indexscan = on #enable_indexonlyscan = on #enable_material = on #enable_mergejoin = on #enable_nestloop = on #enable_parallel_append = on #enable_seqscan = on #enable_sort = on #enable_incremental_sort = on #enable_tidscan = on #enable_partitionwise_join = off #enable_partitionwise_aggregate = off #enable_parallel_hash = on #enable_partition_pruning = on # - Planner Cost Constants - #seq_page_cost = 1.0 # measured on an arbitrary scale #random_page_cost = 4.0 # same scale as above #cpu_tuple_cost = 0.01 # same scale as above #cpu_index_tuple_cost = 0.005 # same scale as above #cpu_operator_cost = 0.0025 # same scale as above #parallel_tuple_cost = 0.1 # same scale as above #parallel_setup_cost = 1000.0 # same scale as above #jit_above_cost = 100000 # perform JIT compilation if available # and query more expensive than this; # -1 disables #jit_inline_above_cost = 500000 # inline small functions if query is # more expensive than this; -1 disables #jit_optimize_above_cost = 500000 # use expensive JIT optimizations if # query is more expensive than this; # -1 disables #min_parallel_table_scan_size = 8MB #min_parallel_index_scan_size = 512kB #effective_cache_size = 4GB # - Genetic Query Optimizer - #geqo = on #geqo_threshold = 12 #geqo_effort = 5 # range 1-10 #geqo_pool_size = 0 # selects default based on effort #geqo_generations = 0 # selects default based on effort #geqo_selection_bias = 2.0 # range 1.5-2.0 #geqo_seed = 0.0 # range 0.0-1.0 # - Other Planner Options - #default_statistics_target = 100 # range 1-10000 #constraint_exclusion = partition # on, off, or partition #cursor_tuple_fraction = 0.1 # range 0.0-1.0 #from_collapse_limit = 8 #join_collapse_limit = 8 # 1 disables collapsing of explicit # JOIN clauses #force_parallel_mode = off #jit = on # allow JIT compilation #plan_cache_mode = auto # auto, force_generic_plan or # force_custom_plan #------------------------------------------------------------------------------ # REPORTING AND LOGGING #------------------------------------------------------------------------------ # - Where to Log - #log_destination = 'stderr' # Valid values are combinations of # stderr, csvlog, syslog, and eventlog, # depending on platform. csvlog # requires logging_collector to be on. # This is used when logging to stderr: #logging_collector = off # Enable capturing of stderr and csvlog # into log files. Required to be on for # csvlogs. # (change requires restart) # These are only used if logging_collector is on: #log_directory = 'log' # directory where log files are written, # can be absolute or relative to PGDATA #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, # can include strftime() escapes #log_file_mode = 0600 # creation mode for log files, # begin with 0 to use octal notation #log_truncate_on_rotation = off # If on, an existing log file with the # same name as the new log file will be # truncated rather than appended to. # But such truncation only occurs on # time-driven rotation, not on restarts # or size-driven rotation. Default is # off, meaning append to existing files # in all cases. #log_rotation_age = 1d # Automatic rotation of logfiles will # happen after that time. 0 disables. #log_rotation_size = 10MB # Automatic rotation of logfiles will # happen after that much log output. # 0 disables. # These are relevant when logging to syslog: #syslog_facility = 'LOCAL0' #syslog_ident = 'postgres' #syslog_sequence_numbers = on #syslog_split_messages = on # This is only relevant when logging to eventlog (win32): # (change requires restart) #event_source = 'PostgreSQL' # - When to Log - #log_min_messages = warning # values in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # log # fatal # panic #log_min_error_statement = error # values in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # log # fatal # panic (effectively off) #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements # and their durations, > 0 logs only # statements running at least this number # of milliseconds #log_min_duration_sample = -1 # -1 is disabled, 0 logs a sample of statements # and their durations, > 0 logs only a sample of # statements running at least this number # of milliseconds; # sample fraction is determined by log_statement_sample_rate #log_statement_sample_rate = 1.0 # fraction of logged statements exceeding # log_min_duration_sample to be logged; # 1.0 logs all such statements, 0.0 never logs #log_transaction_sample_rate = 0.0 # fraction of transactions whose statements # are logged regardless of their duration; 1.0 logs all # statements from all transactions, 0.0 never logs # - What to Log - #debug_print_parse = off #debug_print_rewritten = off #debug_print_plan = off #debug_pretty_print = on #log_checkpoints = off #log_connections = off #log_disconnections = off #log_duration = off #log_error_verbosity = default # terse, default, or verbose messages #log_hostname = off #log_line_prefix = '%m [%p] ' # special values: # %a = application name # %u = user name # %d = database name # %r = remote host and port # %h = remote host # %b = backend type # %p = process ID # %t = timestamp without milliseconds # %m = timestamp with milliseconds # %n = timestamp with milliseconds (as a Unix epoch) # %i = command tag # %e = SQL state # %c = session ID # %l = session line number # %s = session start timestamp # %v = virtual transaction ID # %x = transaction ID (0 if none) # %q = stop here in non-session # processes # %% = '%' # e.g. '<%u%%%d> ' #log_lock_waits = off # log lock waits >= deadlock_timeout #log_parameter_max_length = -1 # when logging statements, limit logged # bind-parameter values to N bytes; # -1 means print in full, 0 disables #log_parameter_max_length_on_error = 0 # when logging an error, limit logged # bind-parameter values to N bytes; # -1 means print in full, 0 disables #log_statement = 'none' # none, ddl, mod, all #log_replication_commands = off #log_temp_files = -1 # log temporary files equal or larger # than the specified size in kilobytes; # -1 disables, 0 logs all temp files log_timezone = 'Etc/UTC' #------------------------------------------------------------------------------ # PROCESS TITLE #------------------------------------------------------------------------------ #cluster_name = '' # added to process titles if nonempty # (change requires restart) #update_process_title = on #------------------------------------------------------------------------------ # STATISTICS #------------------------------------------------------------------------------ # - Query and Index Statistics Collector - #track_activities = on #track_counts = on #track_io_timing = off #track_functions = none # none, pl, all #track_activity_query_size = 1024 # (change requires restart) #stats_temp_directory = 'pg_stat_tmp' # - Monitoring - #log_parser_stats = off #log_planner_stats = off #log_executor_stats = off #log_statement_stats = off #------------------------------------------------------------------------------ # AUTOVACUUM #------------------------------------------------------------------------------ #autovacuum = on # Enable autovacuum subprocess? 'on' # requires track_counts to also be on. #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and # their durations, > 0 logs only # actions running at least this number # of milliseconds. #autovacuum_max_workers = 3 # max number of autovacuum subprocesses # (change requires restart) #autovacuum_naptime = 1min # time between autovacuum runs #autovacuum_vacuum_threshold = 50 # min number of row updates before # vacuum #autovacuum_vacuum_insert_threshold = 1000 # min number of row inserts # before vacuum; -1 disables insert # vacuums #autovacuum_analyze_threshold = 50 # min number of row updates before # analyze #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum #autovacuum_vacuum_insert_scale_factor = 0.2 # fraction of inserts over table # size before insert vacuum #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum # (change requires restart) #autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age # before forced vacuum # (change requires restart) #autovacuum_vacuum_cost_delay = 2ms # default vacuum cost delay for # autovacuum, in milliseconds; # -1 means use vacuum_cost_delay #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for # autovacuum, -1 means use # vacuum_cost_limit #------------------------------------------------------------------------------ # CLIENT CONNECTION DEFAULTS #------------------------------------------------------------------------------ # - Statement Behavior - #client_min_messages = notice # values in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # log # notice # warning # error #search_path = '"$user", public' # schema names #row_security = on #default_tablespace = '' # a tablespace name, '' uses the default #temp_tablespaces = '' # a list of tablespace names, '' uses # only default tablespace #default_table_access_method = 'heap' #check_function_bodies = on #default_transaction_isolation = 'read committed' #default_transaction_read_only = off #default_transaction_deferrable = off #session_replication_role = 'origin' #statement_timeout = 0 # in milliseconds, 0 is disabled #lock_timeout = 0 # in milliseconds, 0 is disabled #idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is disabled #vacuum_freeze_min_age = 50000000 #vacuum_freeze_table_age = 150000000 #vacuum_multixact_freeze_min_age = 5000000 #vacuum_multixact_freeze_table_age = 150000000 #vacuum_cleanup_index_scale_factor = 0.1 # fraction of total number of tuples # before index cleanup, 0 always performs # index cleanup #bytea_output = 'hex' # hex, escape #xmlbinary = 'base64' #xmloption = 'content' #gin_fuzzy_search_limit = 0 #gin_pending_list_limit = 4MB # - Locale and Formatting - datestyle = 'iso, mdy' #intervalstyle = 'postgres' timezone = 'Etc/UTC' #timezone_abbreviations = 'Default' # Select the set of available time zone # abbreviations. Currently, there are # Default # Australia (historical usage) # India # You can create your own file in # share/timezonesets/. #extra_float_digits = 1 # min -15, max 3; any value >0 actually # selects precise output mode #client_encoding = sql_ascii # actually, defaults to database # encoding # These settings are initialized by initdb, but they can be changed. lc_messages = 'en_US.utf8' # locale for system error message # strings lc_monetary = 'en_US.utf8' # locale for monetary formatting lc_numeric = 'en_US.utf8' # locale for number formatting lc_time = 'en_US.utf8' # locale for time formatting # default configuration for text search default_text_search_config = 'pg_catalog.english' # - Shared Library Preloading - #shared_preload_libraries = '' # (change requires restart) #local_preload_libraries = '' #session_preload_libraries = '' #jit_provider = 'llvmjit' # JIT library to use # - Other Defaults - #dynamic_library_path = '$libdir' #extension_destdir = '' # prepend path when loading extensions # and shared objects (added by Debian) #------------------------------------------------------------------------------ # LOCK MANAGEMENT #------------------------------------------------------------------------------ #deadlock_timeout = 1s #max_locks_per_transaction = 64 # min 10 # (change requires restart) #max_pred_locks_per_transaction = 64 # min 10 # (change requires restart) #max_pred_locks_per_relation = -2 # negative values mean # (max_pred_locks_per_transaction # / -max_pred_locks_per_relation) - 1 #max_pred_locks_per_page = 2 # min 0 #------------------------------------------------------------------------------ # VERSION AND PLATFORM COMPATIBILITY #------------------------------------------------------------------------------ # - Previous PostgreSQL Versions - #array_nulls = on #backslash_quote = safe_encoding # on, off, or safe_encoding #escape_string_warning = on #lo_compat_privileges = off #operator_precedence_warning = off #quote_all_identifiers = off #standard_conforming_strings = on #synchronize_seqscans = on # - Other Platforms and Clients - #transform_null_equals = off #------------------------------------------------------------------------------ # ERROR HANDLING #------------------------------------------------------------------------------ #exit_on_error = off # terminate session on any error? #restart_after_crash = on # reinitialize after backend crash? #data_sync_retry = off # retry or panic on failure to fsync # data? # (change requires restart) #------------------------------------------------------------------------------ # CONFIG FILE INCLUDES #------------------------------------------------------------------------------ # These options allow settings to be loaded from files other than the # default postgresql.conf. Note that these are directives, not variable # assignments, so they can usefully be given more than once. #include_dir = '...' # include files ending in '.conf' from # a directory, e.g., 'conf.d' #include_if_exists = '...' # include file only if it exists #include = '...' # include file #------------------------------------------------------------------------------ # CUSTOMIZED OPTIONS #------------------------------------------------------------------------------ # Add settings for extensions here ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/postmaster.opts ================================================ /usr/lib/postgresql/13/bin/postgres ================================================ FILE: Part-4 Django Postgres Redis and Celery/data/db/postmaster.pid ================================================ 1 /var/lib/postgresql/data 1617483916 5432 /var/run/postgresql * 6977 0 ready ================================================ FILE: Part-4 Django Postgres Redis and Celery/db.sqlite3 ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/docker-compose.yml ================================================ version: "3.8" services: # Redis redis: image: redis:alpine container_name: redis # Database Postgres db: image: postgres volumes: - ./data/db:/var/lib/postgresql/data environment: - POSTGRES_DB=postgres - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres container_name: postgres_db # Django Application app: build: . volumes: - .:/django ports: - 8000:8000 image: app:django container_name: django_app command: python manage.py runserver 0.0.0.0:8000 depends_on: - db # Celery celery: restart: always build: context: . command: celery -A core worker -l DEBUG volumes: - .:/django container_name: celery depends_on: - db - redis - app ================================================ FILE: Part-4 Django Postgres Redis and Celery/manage.py ================================================ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() ================================================ FILE: Part-4 Django Postgres Redis and Celery/newapp/__init__.py ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/newapp/admin.py ================================================ from django.contrib import admin # Register your models here. ================================================ FILE: Part-4 Django Postgres Redis and Celery/newapp/apps.py ================================================ from django.apps import AppConfig class NewappConfig(AppConfig): name = 'newapp' ================================================ FILE: Part-4 Django Postgres Redis and Celery/newapp/migrations/__init__.py ================================================ ================================================ FILE: Part-4 Django Postgres Redis and Celery/newapp/tasks.py ================================================ from __future__ import absolute_import, unicode_literals from celery import shared_task @shared_task def add(x, y): return x + y ================================================ FILE: Part-4 Django Postgres Redis and Celery/req.txt ================================================ appdirs==1.4.4 asgiref==3.3.1 astroid==2.4.2 autopep8==1.5.4 black==20.8b1 certifi==2020.12.5 chardet==4.0.0 click==7.1.2 colorama==0.4.3 coverage==5.4 Django==3.1.7 django-cors-headers==3.5.0 django-countries==7.0 django-debug-toolbar==3.2 django-js-asset==1.2.2 django-mptt==0.12.0 django-summernote==0.8.11.6 djangorestframework==3.12.2 Faker==6.6.0 flake8==3.8.4 flake8-django==1.1.1 flake9-isort==4.0.2 idna==2.10 isort==5.7.0 lazy-object-proxy==1.4.3 mccabe==0.6.1 mypy-extensions==0.4.3 pathspec==0.8.1 pep8==1.7.1 Pillow==8.1.2 pycodestyle==2.6.0 pyflakes==2.2.0 pylint==2.6.0 pylint-django==2.4.2 pylint-plugin-utils==0.6 python-dateutil==2.8.1 pytz==2021.1 regex==2020.11.13 requests==2.25.1 six==1.15.0 sqlparse==0.4.1 stripe==2.56.0 testfixtures==6.17.1 text-unidecode==1.3 toml==0.10.2 typed-ast==1.4.2 typing-extensions==3.7.4.3 urllib3==1.26.3 wrapt==1.12.1 ================================================ FILE: Part-4 Django Postgres Redis and Celery/requirements.txt ================================================ asgiref==3.3.1 Django==3.1.7 pytz==2021.1 sqlparse==0.4.1 psycopg2>=2.8 redis>=3.5 celery>=5.0 ================================================ FILE: Part-5 Dockerize a React Application/core/.dockerignore ================================================ .dockerignore Dockerfile ================================================ FILE: Part-5 Dockerize a React Application/core/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ================================================ FILE: Part-5 Dockerize a React Application/core/Dockerfile ================================================ FROM node:15.13-alpine WORKDIR /core ENV PATH="./node_modules/.bin:$PATH" COPY . . RUN npm run build ================================================ FILE: Part-5 Dockerize a React Application/core/commands.txt ================================================ npx create-react-app my-app docker build --tag react . docker run react docker run --publish 3000:3000 react docker-compose build . docker-compose run app ================================================ FILE: Part-5 Dockerize a React Application/core/docker-compose.yml ================================================ version: "3.8" services: app: build: context: . volumes: - .:/core ports: - 3000:3000 image: app:react container_name: react_container command: npm start ================================================ FILE: Part-5 Dockerize a React Application/core/package.json ================================================ { "name": "core", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.11.10", "@testing-library/react": "^11.2.6", "@testing-library/user-event": "^12.8.3", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3", "web-vitals": "^1.1.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: Part-5 Dockerize a React Application/core/public/index.html ================================================ React App
================================================ FILE: Part-5 Dockerize a React Application/core/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: Part-5 Dockerize a React Application/core/public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ================================================ FILE: Part-5 Dockerize a React Application/core/src/App.css ================================================ .App { text-align: center; } .App-logo { height: 40vmin; pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .App-logo { animation: App-logo-spin infinite 20s linear; } } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: Part-5 Dockerize a React Application/core/src/App.js ================================================ import logo from './logo.svg'; import './App.css'; function App() { return (
logo

Edit src/App.js and save to reload.

Learn React
); } export default App; ================================================ FILE: Part-5 Dockerize a React Application/core/src/App.test.js ================================================ import { render, screen } from '@testing-library/react'; import App from './App'; test('renders learn react link', () => { render(); const linkElement = screen.getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); }); ================================================ FILE: Part-5 Dockerize a React Application/core/src/index.css ================================================ body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } ================================================ FILE: Part-5 Dockerize a React Application/core/src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render( , document.getElementById('root') ); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals(); ================================================ FILE: Part-5 Dockerize a React Application/core/src/reportWebVitals.js ================================================ const reportWebVitals = onPerfEntry => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { getCLS(onPerfEntry); getFID(onPerfEntry); getFCP(onPerfEntry); getLCP(onPerfEntry); getTTFB(onPerfEntry); }); } }; export default reportWebVitals; ================================================ FILE: Part-5 Dockerize a React Application/core/src/setupTests.js ================================================ // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom'; ================================================ FILE: Part-5 Dockerize a React Application/core/text.txt ================================================ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/commands.txt ================================================ \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/.dockerignore ================================================ venv ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/Dockerfile ================================================ FROM python:3.8-alpine ENV PYTHONUNBUFFERED 1 WORKDIR /django COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt COPY . . ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/__init__.py ================================================ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/admin.py ================================================ from django.contrib import admin from . import models @admin.register(models.Post) class AuthorAdmin(admin.ModelAdmin): list_display = ('title', 'id', 'status', 'slug', 'author') prepopulated_fields = {'slug': ('title',), } admin.site.register(models.Category) ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/apps.py ================================================ from django.apps import AppConfig class BlogConfig(AppConfig): name = 'blog' ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/migrations/0001_initial.py ================================================ # Generated by Django 3.1.1 on 2020-09-09 20:53 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=100)), ], ), migrations.CreateModel( name='Post', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=250)), ('excerpt', models.TextField(null=True)), ('content', models.TextField()), ('slug', models.SlugField(max_length=250, unique_for_date='publish')), ('published', models.DateTimeField(default=django.utils.timezone.now)), ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published')], default='published', max_length=10)), ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blog_posts', to=settings.AUTH_USER_MODEL)), ('category', models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='blog.category')), ], options={ 'ordering': ('-published',), }, ), ] ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/migrations/__init__.py ================================================ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/models.py ================================================ from django.db import models from django.contrib.auth.models import User from django.utils import timezone class Category(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Post(models.Model): class PostObjects(models.Manager): def get_queryset(self): return super().get_queryset() .filter(status='published') options = ( ('draft', 'Draft'), ('published', 'Published'), ) category = models.ForeignKey( Category, on_delete=models.PROTECT, default=1) title = models.CharField(max_length=250) excerpt = models.TextField(null=True) content = models.TextField() slug = models.SlugField(max_length=250, unique_for_date='published') published = models.DateTimeField(default=timezone.now) author = models.ForeignKey( User, on_delete=models.CASCADE, related_name='blog_posts') status = models.CharField( max_length=10, choices=options, default='published') objects = models.Manager() # default manager postobjects = PostObjects() # custom manager class Meta: ordering = ('-published',) def __str__(self): return self.title ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/tests.py ================================================ from django.test import TestCase from django.contrib.auth.models import User from blog.models import Post, Category class Test_Create_Post(TestCase): @classmethod def setUpTestData(cls): test_category = Category.objects.create(name='django') testuser1 = User.objects.create_user( username='test_user1', password='123456789') testuser1.save() test_post = Post.objects.create( category_id=1, title='Post Title', excerpt='Post Excerpt', content='Post Content', slug='post-title', author_id=1, status='published') test_post.save() def test_blog_content(self): post = Post.postobjects.get(id=1) cat = Category.objects.get(id=1) author = f'{post.author}' excerpt = f'{post.excerpt}' title = f'{post.title}' content = f'{post.content}' status = f'{post.status}' self.assertEqual(author, 'test_user1') self.assertEqual(title, 'Post Title') self.assertEqual(content, 'Post Content') self.assertEqual(status, 'published') self.assertEqual(str(post), "Post Title") self.assertEqual(str(cat), "django") ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog/urls.py ================================================ from django.urls import path from django.views.generic import TemplateView app_name = 'blog' urlpatterns = [ path('', TemplateView.as_view(template_name="blog/index.html")), ] ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/__init__.py ================================================ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/admin.py ================================================ from django.contrib import admin # Register your models here. ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/apps.py ================================================ from django.apps import AppConfig class BlogApiConfig(AppConfig): name = 'blog_api' ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/migrations/__init__.py ================================================ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/models.py ================================================ from django.db import models ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/serializers.py ================================================ from rest_framework import serializers from blog.models import Post class PostSerializer(serializers.ModelSerializer): class Meta: fields = ('id', 'title', 'author', 'excerpt', 'content', 'status') model = Post ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/tests.py ================================================ from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from blog.models import Post, Category from django.contrib.auth.models import User class PostTests(APITestCase): def test_view_posts(self): """ Ensure we can view all objects. """ url = reverse('blog_api:listcreate') response = self.client.get(url, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK) def test_create_account(self): """ Ensure we can create a new Post object and view object. """ self.test_category = Category.objects.create(name='django') self.testuser1 = User.objects.create_user( username='test_user1', password='123456789') data = {"title": "new", "author": 1, "excerpt": "new", "content": "new"} url = reverse('blog_api:listcreate') response = self.client.post(url, data, format='json') self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(len(response.data), 6) root = reverse(('blog_api:detailcreate'), kwargs={'pk': 1}) response = self.client.get(url, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK) ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/urls.py ================================================ from django.urls import path from .views import PostList, PostDetail app_name = 'blog_api' urlpatterns = [ path('/', PostDetail.as_view(), name='detailcreate'), path('', PostList.as_view(), name='listcreate'), ] ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/blog_api/views.py ================================================ from rest_framework import generics from blog.models import Post from .serializers import PostSerializer class PostList(generics.ListCreateAPIView): queryset = Post.objects.all() serializer_class = PostSerializer class PostDetail(generics.RetrieveDestroyAPIView): queryset = Post.objects.all() serializer_class = PostSerializer """ Concrete View Classes #CreateAPIView Used for create-only endpoints. #ListAPIView Used for read-only endpoints to represent a collection of model instances. #RetrieveAPIView Used for read-only endpoints to represent a single model instance. #DestroyAPIView Used for delete-only endpoints for a single model instance. #UpdateAPIView Used for update-only endpoints for a single model instance. ##ListCreateAPIView Used for read-write endpoints to represent a collection of model instances. RetrieveUpdateAPIView Used for read or update endpoints to represent a single model instance. #RetrieveDestroyAPIView Used for read or delete endpoints to represent a single model instance. #RetrieveUpdateDestroyAPIView Used for read-write-delete endpoints to represent a single model instance. """ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/commands.txt ================================================ py manage.py makemigrations --dry-run --verbosity 3 py manage.py runserver py manage.py createsuperuser pip install coverage coverage run --omit='*/venv/*' manage.py test coverage html pip install djangorestframework ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/core/__init__.py ================================================ ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/core/asgi.py ================================================ """ ASGI config for core project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_asgi_application() ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/core/settings.py ================================================ """ Django settings for core project. Generated by 'django-admin startproject' using Django 3.1.1. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'o$&u%nbd)@uta53xz=zl1(3icpuhun2%pz(17^6lbgf(g%qa#f' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog', 'blog_api', 'rest_framework', 'corsheaders', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'core.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR / 'templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'core.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.AllowAny', ] } CORS_ALLOWED_ORIGINS = [ "http://127.0.0.1:3000", "http://localhost:3000" ] ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/core/urls.py ================================================ """core URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('blog.urls', namespace='blog')), path('api/', include('blog_api.urls', namespace='blog_api')), ] ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/core/wsgi.py ================================================ """ WSGI config for core project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') application = get_wsgi_application() ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog___init___py.html ================================================ Coverage for blog\__init__.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_admin_py.html ================================================ Coverage for blog\admin.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.contrib import admin 

2from . import models 

3 

4 

5@admin.register(models.Post) 

6class AuthorAdmin(admin.ModelAdmin): 

7 list_display = ('title', 'id', 'status', 'slug', 'author') 

8 prepopulated_fields = {'slug': ('title',), } 

9 

10 

11admin.site.register(models.Category) 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api___init___py.html ================================================ Coverage for blog_api\__init__.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api_admin_py.html ================================================ Coverage for blog_api\admin.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.contrib import admin 

2 

3# Register your models here. 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api_migrations___init___py.html ================================================ Coverage for blog_api\migrations\__init__.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api_models_py.html ================================================ Coverage for blog_api\models.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.db import models 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api_serializers_py.html ================================================ Coverage for blog_api\serializers.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from rest_framework import serializers 

2from blog.models import Post 

3 

4 

5class PostSerializer(serializers.ModelSerializer): 

6 class Meta: 

7 fields = ('id', 'title', 'author', 'excerpt', 'content', 'status') 

8 model = Post 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api_tests_py.html ================================================ Coverage for blog_api\tests.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.test import TestCase 

2 

3# Create your tests here. 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api_urls_py.html ================================================ Coverage for blog_api\urls.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.urls import path 

2from .views import PostList, PostDetail 

3 

4app_name = 'blog_api' 

5 

6urlpatterns = [ 

7 path('<int:pk>/', PostDetail.as_view()), 

8 path('', PostList.as_view()), 

9] 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_api_views_py.html ================================================ Coverage for blog_api\views.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from rest_framework import generics 

2from blog.models import Post 

3from .serializers import PostSerializer 

4 

5 

6class PostList(generics.ListCreateAPIView): 

7 queryset = Post.objects.all() 

8 serializer_class = PostSerializer 

9 

10 

11class PostDetail(generics.RetrieveDestroyAPIView): 

12 queryset = Post.objects.all() 

13 serializer_class = PostSerializer 

14 

15 

16""" Concrete View Classes 

17#CreateAPIView 

18Used for create-only endpoints. 

19#ListAPIView 

20Used for read-only endpoints to represent a collection of model instances. 

21#RetrieveAPIView 

22Used for read-only endpoints to represent a single model instance. 

23#DestroyAPIView 

24Used for delete-only endpoints for a single model instance. 

25#UpdateAPIView 

26Used for update-only endpoints for a single model instance. 

27##ListCreateAPIView 

28Used for read-write endpoints to represent a collection of model instances. 

29RetrieveUpdateAPIView 

30Used for read or update endpoints to represent a single model instance. 

31#RetrieveDestroyAPIView 

32Used for read or delete endpoints to represent a single model instance. 

33#RetrieveUpdateDestroyAPIView 

34Used for read-write-delete endpoints to represent a single model instance. 

35""" 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_migrations_0001_initial_py.html ================================================ Coverage for blog\migrations\0001_initial.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# Generated by Django 3.1.1 on 2020-09-09 20:53 

2 

3from django.conf import settings 

4from django.db import migrations, models 

5import django.db.models.deletion 

6import django.utils.timezone 

7 

8 

9class Migration(migrations.Migration): 

10 

11 initial = True 

12 

13 dependencies = [ 

14 migrations.swappable_dependency(settings.AUTH_USER_MODEL), 

15 ] 

16 

17 operations = [ 

18 migrations.CreateModel( 

19 name='Category', 

20 fields=[ 

21 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

22 ('name', models.CharField(max_length=100)), 

23 ], 

24 ), 

25 migrations.CreateModel( 

26 name='Post', 

27 fields=[ 

28 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 

29 ('title', models.CharField(max_length=250)), 

30 ('excerpt', models.TextField(null=True)), 

31 ('content', models.TextField()), 

32 ('slug', models.SlugField(max_length=250, unique_for_date='publish')), 

33 ('published', models.DateTimeField(default=django.utils.timezone.now)), 

34 ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published')], default='published', max_length=10)), 

35 ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blog_posts', to=settings.AUTH_USER_MODEL)), 

36 ('category', models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='blog.category')), 

37 ], 

38 options={ 

39 'ordering': ('-published',), 

40 }, 

41 ), 

42 ] 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_migrations___init___py.html ================================================ Coverage for blog\migrations\__init__.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_models_py.html ================================================ Coverage for blog\models.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.db import models 

2from django.contrib.auth.models import User 

3from django.utils import timezone 

4 

5 

6class Category(models.Model): 

7 name = models.CharField(max_length=100) 

8 

9 def __str__(self): 

10 return self.name 

11 

12 

13class Post(models.Model): 

14 

15 class PostObjects(models.Manager): 

16 def get_queryset(self): 

17 return super().get_queryset() .filter(status='published') 

18 

19 options = ( 

20 ('draft', 'Draft'), 

21 ('published', 'Published'), 

22 ) 

23 category = models.ForeignKey( 

24 Category, on_delete=models.PROTECT, default=1) 

25 title = models.CharField(max_length=250) 

26 excerpt = models.TextField(null=True) 

27 content = models.TextField() 

28 slug = models.SlugField(max_length=250, unique_for_date='published') 

29 published = models.DateTimeField(default=timezone.now) 

30 author = models.ForeignKey( 

31 User, on_delete=models.CASCADE, related_name='blog_posts') 

32 status = models.CharField( 

33 max_length=10, choices=options, default='published') 

34 objects = models.Manager() # default manager 

35 postobjects = PostObjects() # custom manager 

36 

37 class Meta: 

38 ordering = ('-published',) 

39 

40 def __str__(self): 

41 return self.title 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_tests_py.html ================================================ Coverage for blog\tests.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.test import TestCase 

2from django.contrib.auth.models import User 

3from blog.models import Post, Category 

4 

5 

6class Test_Create_Post(TestCase): 

7 

8 @classmethod 

9 def setUpTestData(cls): 

10 test_category = Category.objects.create(name='django') 

11 

12 testuser1 = User.objects.create_user( 

13 username='test_user1', password='123456789') 

14 testuser1.save() 

15 

16 test_post = Post.objects.create( 

17 category_id=1, title='Post Title', excerpt='Post Excerpt', content='Post Content', slug='post-title', author_id=1, status='published') 

18 test_post.save() 

19 

20 def test_blog_content(self): 

21 post = Post.postobjects.get(id=1) 

22 cat = Category.objects.get(id=1) 

23 author = f'{post.author}' 

24 excerpt = f'{post.excerpt}' 

25 title = f'{post.title}' 

26 content = f'{post.content}' 

27 status = f'{post.status}' 

28 self.assertEqual(author, 'test_user1') 

29 self.assertEqual(title, 'Post Title') 

30 self.assertEqual(content, 'Post Content') 

31 self.assertEqual(status, 'published') 

32 self.assertEqual(str(post), "Post Title") 

33 self.assertEqual(str(cat), "django") 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/blog_urls_py.html ================================================ Coverage for blog\urls.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from django.urls import path 

2from django.views.generic import TemplateView 

3 

4app_name = 'blog' 

5 

6urlpatterns = [ 

7 path('', TemplateView.as_view(template_name="blog/index.html")), 

8] 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/core___init___py.html ================================================ Coverage for core\__init__.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/core_settings_py.html ================================================ Coverage for core\settings.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2Django settings for core project. 

3 

4Generated by 'django-admin startproject' using Django 3.1.1. 

5 

6For more information on this file, see 

7https://docs.djangoproject.com/en/3.1/topics/settings/ 

8 

9For the full list of settings and their values, see 

10https://docs.djangoproject.com/en/3.1/ref/settings/ 

11""" 

12 

13from pathlib import Path 

14 

15# Build paths inside the project like this: BASE_DIR / 'subdir'. 

16BASE_DIR = Path(__file__).resolve().parent.parent 

17 

18 

19# Quick-start development settings - unsuitable for production 

20# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ 

21 

22# SECURITY WARNING: keep the secret key used in production secret! 

23SECRET_KEY = 'o$&u%nbd)@uta53xz=zl1(3icpuhun2%pz(17^6lbgf(g%qa#f' 

24 

25# SECURITY WARNING: don't run with debug turned on in production! 

26DEBUG = True 

27 

28ALLOWED_HOSTS = [] 

29 

30 

31# Application definition 

32 

33INSTALLED_APPS = [ 

34 'django.contrib.admin', 

35 'django.contrib.auth', 

36 'django.contrib.contenttypes', 

37 'django.contrib.sessions', 

38 'django.contrib.messages', 

39 'django.contrib.staticfiles', 

40 'blog', 

41 'blog_api', 

42 'rest_framework', 

43] 

44 

45MIDDLEWARE = [ 

46 'django.middleware.security.SecurityMiddleware', 

47 'django.contrib.sessions.middleware.SessionMiddleware', 

48 'django.middleware.common.CommonMiddleware', 

49 'django.middleware.csrf.CsrfViewMiddleware', 

50 'django.contrib.auth.middleware.AuthenticationMiddleware', 

51 'django.contrib.messages.middleware.MessageMiddleware', 

52 'django.middleware.clickjacking.XFrameOptionsMiddleware', 

53] 

54 

55ROOT_URLCONF = 'core.urls' 

56 

57TEMPLATES = [ 

58 { 

59 'BACKEND': 'django.template.backends.django.DjangoTemplates', 

60 'DIRS': [], 

61 'APP_DIRS': True, 

62 'OPTIONS': { 

63 'context_processors': [ 

64 'django.template.context_processors.debug', 

65 'django.template.context_processors.request', 

66 'django.contrib.auth.context_processors.auth', 

67 'django.contrib.messages.context_processors.messages', 

68 ], 

69 }, 

70 }, 

71] 

72 

73WSGI_APPLICATION = 'core.wsgi.application' 

74 

75 

76# Database 

77# https://docs.djangoproject.com/en/3.1/ref/settings/#databases 

78 

79DATABASES = { 

80 'default': { 

81 'ENGINE': 'django.db.backends.sqlite3', 

82 'NAME': BASE_DIR / 'db.sqlite3', 

83 } 

84} 

85 

86 

87# Password validation 

88# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators 

89 

90AUTH_PASSWORD_VALIDATORS = [ 

91 { 

92 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 

93 }, 

94 { 

95 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 

96 }, 

97 { 

98 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 

99 }, 

100 { 

101 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 

102 }, 

103] 

104 

105 

106# Internationalization 

107# https://docs.djangoproject.com/en/3.1/topics/i18n/ 

108 

109LANGUAGE_CODE = 'en-us' 

110 

111TIME_ZONE = 'UTC' 

112 

113USE_I18N = True 

114 

115USE_L10N = True 

116 

117USE_TZ = True 

118 

119 

120# Static files (CSS, JavaScript, Images) 

121# https://docs.djangoproject.com/en/3.1/howto/static-files/ 

122 

123STATIC_URL = '/static/' 

124 

125 

126REST_FRAMEWORK = { 

127 'DEFAULT_PERMISSION_CLASSES': [ 

128 'rest_framework.permissions.AllowAny', 

129 ] 

130} 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/core_urls_py.html ================================================ Coverage for core\urls.py: 100%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""core URL Configuration 

2 

3The `urlpatterns` list routes URLs to views. For more information please see: 

4 https://docs.djangoproject.com/en/3.1/topics/http/urls/ 

5Examples: 

6Function views 

7 1. Add an import: from my_app import views 

8 2. Add a URL to urlpatterns: path('', views.home, name='home') 

9Class-based views 

10 1. Add an import: from other_app.views import Home 

11 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 

12Including another URLconf 

13 1. Import the include() function: from django.urls import include, path 

14 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 

15""" 

16from django.contrib import admin 

17from django.urls import path, include 

18 

19urlpatterns = [ 

20 path('admin/', admin.site.urls), 

21 path('', include('blog.urls', namespace='blog')), 

22 path('api/', include('blog_api.urls', namespace='blog_api')), 

23] 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/coverage_html.js ================================================ // Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 // For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt // Coverage.py HTML report browser code. /*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */ /*global coverage: true, document, window, $ */ coverage = {}; // Find all the elements with shortkey_* class, and use them to assign a shortcut key. coverage.assign_shortkeys = function () { $("*[class*='shortkey_']").each(function (i, e) { $.each($(e).attr("class").split(" "), function (i, c) { if (/^shortkey_/.test(c)) { $(document).bind('keydown', c.substr(9), function () { $(e).click(); }); } }); }); }; // Create the events for the help panel. coverage.wire_up_help_panel = function () { $("#keyboard_icon").click(function () { // Show the help panel, and position it so the keyboard icon in the // panel is in the same place as the keyboard icon in the header. $(".help_panel").show(); var koff = $("#keyboard_icon").offset(); var poff = $("#panel_icon").position(); $(".help_panel").offset({ top: koff.top-poff.top, left: koff.left-poff.left }); }); $("#panel_icon").click(function () { $(".help_panel").hide(); }); }; // Create the events for the filter box. coverage.wire_up_filter = function () { // Cache elements. var table = $("table.index"); var table_rows = table.find("tbody tr"); var table_row_names = table_rows.find("td.name a"); var no_rows = $("#no_rows"); // Create a duplicate table footer that we can modify with dynamic summed values. var table_footer = $("table.index tfoot tr"); var table_dynamic_footer = table_footer.clone(); table_dynamic_footer.attr('class', 'total_dynamic hidden'); table_footer.after(table_dynamic_footer); // Observe filter keyevents. $("#filter").on("keyup change", $.debounce(150, function (event) { var filter_value = $(this).val(); if (filter_value === "") { // Filter box is empty, remove all filtering. table_rows.removeClass("hidden"); // Show standard footer, hide dynamic footer. table_footer.removeClass("hidden"); table_dynamic_footer.addClass("hidden"); // Hide placeholder, show table. if (no_rows.length > 0) { no_rows.hide(); } table.show(); } else { // Filter table items by value. var hidden = 0; var shown = 0; // Hide / show elements. $.each(table_row_names, function () { var element = $(this).parents("tr"); if ($(this).text().indexOf(filter_value) === -1) { // hide element.addClass("hidden"); hidden++; } else { // show element.removeClass("hidden"); shown++; } }); // Show placeholder if no rows will be displayed. if (no_rows.length > 0) { if (shown === 0) { // Show placeholder, hide table. no_rows.show(); table.hide(); } else { // Hide placeholder, show table. no_rows.hide(); table.show(); } } // Manage dynamic header: if (hidden > 0) { // Calculate new dynamic sum values based on visible rows. for (var column = 2; column < 20; column++) { // Calculate summed value. var cells = table_rows.find('td:nth-child(' + column + ')'); if (!cells.length) { // No more columns...! break; } var sum = 0, numer = 0, denom = 0; $.each(cells.filter(':visible'), function () { var ratio = $(this).data("ratio"); if (ratio) { var splitted = ratio.split(" "); numer += parseInt(splitted[0], 10); denom += parseInt(splitted[1], 10); } else { sum += parseInt(this.innerHTML, 10); } }); // Get footer cell element. var footer_cell = table_dynamic_footer.find('td:nth-child(' + column + ')'); // Set value into dynamic footer cell element. if (cells[0].innerHTML.indexOf('%') > -1) { // Percentage columns use the numerator and denominator, // and adapt to the number of decimal places. var match = /\.([0-9]+)/.exec(cells[0].innerHTML); var places = 0; if (match) { places = match[1].length; } var pct = numer * 100 / denom; footer_cell.text(pct.toFixed(places) + '%'); } else { footer_cell.text(sum); } } // Hide standard footer, show dynamic footer. table_footer.addClass("hidden"); table_dynamic_footer.removeClass("hidden"); } else { // Show standard footer, hide dynamic footer. table_footer.removeClass("hidden"); table_dynamic_footer.addClass("hidden"); } } })); // Trigger change event on setup, to force filter on page refresh // (filter value may still be present). $("#filter").trigger("change"); }; // Loaded on index.html coverage.index_ready = function ($) { // Look for a localStorage item containing previous sort settings: var sort_list = []; var storage_name = "COVERAGE_INDEX_SORT"; var stored_list = undefined; try { stored_list = localStorage.getItem(storage_name); } catch(err) {} if (stored_list) { sort_list = JSON.parse('[[' + stored_list + ']]'); } // Create a new widget which exists only to save and restore // the sort order: $.tablesorter.addWidget({ id: "persistentSort", // Format is called by the widget before displaying: format: function (table) { if (table.config.sortList.length === 0 && sort_list.length > 0) { // This table hasn't been sorted before - we'll use // our stored settings: $(table).trigger('sorton', [sort_list]); } else { // This is not the first load - something has // already defined sorting so we'll just update // our stored value to match: sort_list = table.config.sortList; } } }); // Configure our tablesorter to handle the variable number of // columns produced depending on report options: var headers = []; var col_count = $("table.index > thead > tr > th").length; headers[0] = { sorter: 'text' }; for (i = 1; i < col_count-1; i++) { headers[i] = { sorter: 'digit' }; } headers[col_count-1] = { sorter: 'percent' }; // Enable the table sorter: $("table.index").tablesorter({ widgets: ['persistentSort'], headers: headers }); coverage.assign_shortkeys(); coverage.wire_up_help_panel(); coverage.wire_up_filter(); // Watch for page unload events so we can save the final sort settings: $(window).unload(function () { try { localStorage.setItem(storage_name, sort_list.toString()) } catch(err) {} }); }; // -- pyfile stuff -- coverage.pyfile_ready = function ($) { // If we're directed to a particular line number, highlight the line. var frag = location.hash; if (frag.length > 2 && frag[1] === 't') { $(frag).addClass('highlight'); coverage.set_sel(parseInt(frag.substr(2), 10)); } else { coverage.set_sel(0); } $(document) .bind('keydown', 'j', coverage.to_next_chunk_nicely) .bind('keydown', 'k', coverage.to_prev_chunk_nicely) .bind('keydown', '0', coverage.to_top) .bind('keydown', '1', coverage.to_first_chunk) ; $(".button_toggle_run").click(function (evt) {coverage.toggle_lines(evt.target, "run");}); $(".button_toggle_exc").click(function (evt) {coverage.toggle_lines(evt.target, "exc");}); $(".button_toggle_mis").click(function (evt) {coverage.toggle_lines(evt.target, "mis");}); $(".button_toggle_par").click(function (evt) {coverage.toggle_lines(evt.target, "par");}); coverage.assign_shortkeys(); coverage.wire_up_help_panel(); coverage.init_scroll_markers(); // Rebuild scroll markers when the window height changes. $(window).resize(coverage.build_scroll_markers); }; coverage.toggle_lines = function (btn, cls) { btn = $(btn); var show = "show_"+cls; if (btn.hasClass(show)) { $("#source ." + cls).removeClass(show); btn.removeClass(show); } else { $("#source ." + cls).addClass(show); btn.addClass(show); } coverage.build_scroll_markers(); }; // Return the nth line div. coverage.line_elt = function (n) { return $("#t" + n); }; // Return the nth line number div. coverage.num_elt = function (n) { return $("#n" + n); }; // Set the selection. b and e are line numbers. coverage.set_sel = function (b, e) { // The first line selected. coverage.sel_begin = b; // The next line not selected. coverage.sel_end = (e === undefined) ? b+1 : e; }; coverage.to_top = function () { coverage.set_sel(0, 1); coverage.scroll_window(0); }; coverage.to_first_chunk = function () { coverage.set_sel(0, 1); coverage.to_next_chunk(); }; // Return a string indicating what kind of chunk this line belongs to, // or null if not a chunk. coverage.chunk_indicator = function (line_elt) { var klass = line_elt.attr('class'); if (klass) { var m = klass.match(/\bshow_\w+\b/); if (m) { return m[0]; } } return null; }; coverage.to_next_chunk = function () { var c = coverage; // Find the start of the next colored chunk. var probe = c.sel_end; var chunk_indicator, probe_line; while (true) { probe_line = c.line_elt(probe); if (probe_line.length === 0) { return; } chunk_indicator = c.chunk_indicator(probe_line); if (chunk_indicator) { break; } probe++; } // There's a next chunk, `probe` points to it. var begin = probe; // Find the end of this chunk. var next_indicator = chunk_indicator; while (next_indicator === chunk_indicator) { probe++; probe_line = c.line_elt(probe); next_indicator = c.chunk_indicator(probe_line); } c.set_sel(begin, probe); c.show_selection(); }; coverage.to_prev_chunk = function () { var c = coverage; // Find the end of the prev colored chunk. var probe = c.sel_begin-1; var probe_line = c.line_elt(probe); if (probe_line.length === 0) { return; } var chunk_indicator = c.chunk_indicator(probe_line); while (probe > 0 && !chunk_indicator) { probe--; probe_line = c.line_elt(probe); if (probe_line.length === 0) { return; } chunk_indicator = c.chunk_indicator(probe_line); } // There's a prev chunk, `probe` points to its last line. var end = probe+1; // Find the beginning of this chunk. var prev_indicator = chunk_indicator; while (prev_indicator === chunk_indicator) { probe--; probe_line = c.line_elt(probe); prev_indicator = c.chunk_indicator(probe_line); } c.set_sel(probe+1, end); c.show_selection(); }; // Return the line number of the line nearest pixel position pos coverage.line_at_pos = function (pos) { var l1 = coverage.line_elt(1), l2 = coverage.line_elt(2), result; if (l1.length && l2.length) { var l1_top = l1.offset().top, line_height = l2.offset().top - l1_top, nlines = (pos - l1_top) / line_height; if (nlines < 1) { result = 1; } else { result = Math.ceil(nlines); } } else { result = 1; } return result; }; // Returns 0, 1, or 2: how many of the two ends of the selection are on // the screen right now? coverage.selection_ends_on_screen = function () { if (coverage.sel_begin === 0) { return 0; } var top = coverage.line_elt(coverage.sel_begin); var next = coverage.line_elt(coverage.sel_end-1); return ( (top.isOnScreen() ? 1 : 0) + (next.isOnScreen() ? 1 : 0) ); }; coverage.to_next_chunk_nicely = function () { coverage.finish_scrolling(); if (coverage.selection_ends_on_screen() === 0) { // The selection is entirely off the screen: select the top line on // the screen. var win = $(window); coverage.select_line_or_chunk(coverage.line_at_pos(win.scrollTop())); } coverage.to_next_chunk(); }; coverage.to_prev_chunk_nicely = function () { coverage.finish_scrolling(); if (coverage.selection_ends_on_screen() === 0) { var win = $(window); coverage.select_line_or_chunk(coverage.line_at_pos(win.scrollTop() + win.height())); } coverage.to_prev_chunk(); }; // Select line number lineno, or if it is in a colored chunk, select the // entire chunk coverage.select_line_or_chunk = function (lineno) { var c = coverage; var probe_line = c.line_elt(lineno); if (probe_line.length === 0) { return; } var the_indicator = c.chunk_indicator(probe_line); if (the_indicator) { // The line is in a highlighted chunk. // Search backward for the first line. var probe = lineno; var indicator = the_indicator; while (probe > 0 && indicator === the_indicator) { probe--; probe_line = c.line_elt(probe); if (probe_line.length === 0) { break; } indicator = c.chunk_indicator(probe_line); } var begin = probe + 1; // Search forward for the last line. probe = lineno; indicator = the_indicator; while (indicator === the_indicator) { probe++; probe_line = c.line_elt(probe); indicator = c.chunk_indicator(probe_line); } coverage.set_sel(begin, probe); } else { coverage.set_sel(lineno); } }; coverage.show_selection = function () { var c = coverage; // Highlight the lines in the chunk $(".linenos .highlight").removeClass("highlight"); for (var probe = c.sel_begin; probe > 0 && probe < c.sel_end; probe++) { c.num_elt(probe).addClass("highlight"); } c.scroll_to_selection(); }; coverage.scroll_to_selection = function () { // Scroll the page if the chunk isn't fully visible. if (coverage.selection_ends_on_screen() < 2) { // Need to move the page. The html,body trick makes it scroll in all // browsers, got it from http://stackoverflow.com/questions/3042651 var top = coverage.line_elt(coverage.sel_begin); var top_pos = parseInt(top.offset().top, 10); coverage.scroll_window(top_pos - 30); } }; coverage.scroll_window = function (to_pos) { $("html,body").animate({scrollTop: to_pos}, 200); }; coverage.finish_scrolling = function () { $("html,body").stop(true, true); }; coverage.init_scroll_markers = function () { var c = coverage; // Init some variables c.lines_len = $('#source p').length; c.body_h = $('body').height(); c.header_h = $('div#header').height(); // Build html c.build_scroll_markers(); }; coverage.build_scroll_markers = function () { var c = coverage, min_line_height = 3, max_line_height = 10, visible_window_h = $(window).height(); c.lines_to_mark = $('#source').find('p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par'); $('#scroll_marker').remove(); // Don't build markers if the window has no scroll bar. if (c.body_h <= visible_window_h) { return; } $("body").append("
 
"); var scroll_marker = $('#scroll_marker'), marker_scale = scroll_marker.height() / c.body_h, line_height = scroll_marker.height() / c.lines_len; // Line height must be between the extremes. if (line_height > min_line_height) { if (line_height > max_line_height) { line_height = max_line_height; } } else { line_height = min_line_height; } var previous_line = -99, last_mark, last_top, offsets = {}; // Calculate line offsets outside loop to prevent relayouts c.lines_to_mark.each(function() { offsets[this.id] = $(this).offset().top; }); c.lines_to_mark.each(function () { var id_name = $(this).attr('id'), line_top = Math.round(offsets[id_name] * marker_scale), line_number = parseInt(id_name.substring(1, id_name.length)); if (line_number === previous_line + 1) { // If this solid missed block just make previous mark higher. last_mark.css({ 'height': line_top + line_height - last_top }); } else { // Add colored line in scroll_marker block. scroll_marker.append('
'); last_mark = $('#m' + line_number); last_mark.css({ 'height': line_height, 'top': line_top }); last_top = line_top; } previous_line = line_number; }); }; ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/index.html ================================================ Coverage report
Hide keyboard shortcuts

Hot-keys on this page

n s m x c   change column sorting

Module statements missing excluded coverage
Total 127 2 0 98%
blog\__init__.py 0 0 0 100%
blog\admin.py 7 0 0 100%
blog\migrations\0001_initial.py 8 0 0 100%
blog\migrations\__init__.py 0 0 0 100%
blog\models.py 26 0 0 100%
blog\tests.py 25 0 0 100%
blog\urls.py 4 0 0 100%
blog_api\__init__.py 0 0 0 100%
blog_api\admin.py 1 0 0 100%
blog_api\migrations\__init__.py 0 0 0 100%
blog_api\models.py 1 0 0 100%
blog_api\serializers.py 6 0 0 100%
blog_api\tests.py 1 0 0 100%
blog_api\urls.py 4 0 0 100%
blog_api\views.py 10 0 0 100%
core\__init__.py 0 0 0 100%
core\settings.py 19 0 0 100%
core\urls.py 3 0 0 100%
manage.py 12 2 0 83%

No items found using the specified filter.

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/jquery.hotkeys.js ================================================ /* * jQuery Hotkeys Plugin * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * * Based upon the plugin by Tzury Bar Yochay: * http://github.com/tzuryby/hotkeys * * Original idea by: * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ */ (function(jQuery){ jQuery.hotkeys = { version: "0.8", specialKeys: { 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta" }, shiftNums: { "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", ".": ">", "/": "?", "\\": "|" } }; function keyHandler( handleObj ) { // Only care when a possible input has been specified if ( typeof handleObj.data !== "string" ) { return; } var origHandler = handleObj.handler, keys = handleObj.data.toLowerCase().split(" "); handleObj.handler = function( event ) { // Don't fire in text-accepting inputs that we didn't directly bind to if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || event.target.type === "text") ) { return; } // Keypress represents characters, not special keys var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], character = String.fromCharCode( event.which ).toLowerCase(), key, modif = "", possible = {}; // check combinations (alt|ctrl|shift+anything) if ( event.altKey && special !== "alt" ) { modif += "alt+"; } if ( event.ctrlKey && special !== "ctrl" ) { modif += "ctrl+"; } // TODO: Need to make sure this works consistently across platforms if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { modif += "meta+"; } if ( event.shiftKey && special !== "shift" ) { modif += "shift+"; } if ( special ) { possible[ modif + special ] = true; } else { possible[ modif + character ] = true; possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" if ( modif === "shift+" ) { possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; } } for ( var i = 0, l = keys.length; i < l; i++ ) { if ( possible[ keys[i] ] ) { return origHandler.apply( this, arguments ); } } }; } jQuery.each([ "keydown", "keyup", "keypress" ], function() { jQuery.event.special[ this ] = { add: keyHandler }; }); })( jQuery ); ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/jquery.isonscreen.js ================================================ /* Copyright (c) 2010 * @author Laurence Wheway * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * * @version 1.2.0 */ (function($) { jQuery.extend({ isOnScreen: function(box, container) { //ensure numbers come in as intgers (not strings) and remove 'px' is it's there for(var i in box){box[i] = parseFloat(box[i])}; for(var i in container){container[i] = parseFloat(container[i])}; if(!container){ container = { left: $(window).scrollLeft(), top: $(window).scrollTop(), width: $(window).width(), height: $(window).height() } } if( box.left+box.width-container.left > 0 && box.left < container.width+container.left && box.top+box.height-container.top > 0 && box.top < container.height+container.top ) return true; return false; } }) jQuery.fn.isOnScreen = function (container) { for(var i in container){container[i] = parseFloat(container[i])}; if(!container){ container = { left: $(window).scrollLeft(), top: $(window).scrollTop(), width: $(window).width(), height: $(window).height() } } if( $(this).offset().left+$(this).width()-container.left > 0 && $(this).offset().left < container.width+container.left && $(this).offset().top+$(this).height()-container.top > 0 && $(this).offset().top < container.height+container.top ) return true; return false; } })(jQuery); ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/manage_py.html ================================================ Coverage for manage.py: 83%
Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/bin/env python 

2"""Django's command-line utility for administrative tasks.""" 

3import os 

4import sys 

5 

6 

7def main(): 

8 """Run administrative tasks.""" 

9 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') 

10 try: 

11 from django.core.management import execute_from_command_line 

12 except ImportError as exc: 

13 raise ImportError( 

14 "Couldn't import Django. Are you sure it's installed and " 

15 "available on your PYTHONPATH environment variable? Did you " 

16 "forget to activate a virtual environment?" 

17 ) from exc 

18 execute_from_command_line(sys.argv) 

19 

20 

21if __name__ == '__main__': 

22 main() 

================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/status.json ================================================ {"format":2,"version":"5.2.1","globals":"c3fc29d529a3af98c1a2065daa2addf6","files":{"blog___init___py":{"hash":"af9d0d0de0ea3b71d198bc63f1499a7d","index":{"nums":[1,0,0,0,0,0,0],"html_filename":"blog___init___py.html","relative_filename":"blog\\__init__.py"}},"blog_admin_py":{"hash":"c4a66b1f102077f89e36517da546c95e","index":{"nums":[1,7,0,0,0,0,0],"html_filename":"blog_admin_py.html","relative_filename":"blog\\admin.py"}},"blog_migrations_0001_initial_py":{"hash":"50ef0f6229ac0ec033622371063921a8","index":{"nums":[1,8,0,0,0,0,0],"html_filename":"blog_migrations_0001_initial_py.html","relative_filename":"blog\\migrations\\0001_initial.py"}},"blog_migrations___init___py":{"hash":"af9d0d0de0ea3b71d198bc63f1499a7d","index":{"nums":[1,0,0,0,0,0,0],"html_filename":"blog_migrations___init___py.html","relative_filename":"blog\\migrations\\__init__.py"}},"blog_models_py":{"hash":"90df91e80c9619f5d6119ab3b921b75b","index":{"nums":[1,26,0,0,0,0,0],"html_filename":"blog_models_py.html","relative_filename":"blog\\models.py"}},"blog_tests_py":{"hash":"8b1753411cf60b3959028fb10772600e","index":{"nums":[1,25,0,0,0,0,0],"html_filename":"blog_tests_py.html","relative_filename":"blog\\tests.py"}},"blog_urls_py":{"hash":"5de25e221f5f526ff48181ca0726b942","index":{"nums":[1,4,0,0,0,0,0],"html_filename":"blog_urls_py.html","relative_filename":"blog\\urls.py"}},"blog_api___init___py":{"hash":"af9d0d0de0ea3b71d198bc63f1499a7d","index":{"nums":[1,0,0,0,0,0,0],"html_filename":"blog_api___init___py.html","relative_filename":"blog_api\\__init__.py"}},"blog_api_admin_py":{"hash":"23b3f8ab894286afb6416200cf284c31","index":{"nums":[1,1,0,0,0,0,0],"html_filename":"blog_api_admin_py.html","relative_filename":"blog_api\\admin.py"}},"blog_api_migrations___init___py":{"hash":"af9d0d0de0ea3b71d198bc63f1499a7d","index":{"nums":[1,0,0,0,0,0,0],"html_filename":"blog_api_migrations___init___py.html","relative_filename":"blog_api\\migrations\\__init__.py"}},"blog_api_models_py":{"hash":"86756c38c1bc46a4338a9787cdec3d9f","index":{"nums":[1,1,0,0,0,0,0],"html_filename":"blog_api_models_py.html","relative_filename":"blog_api\\models.py"}},"blog_api_tests_py":{"hash":"f19c76500f700766a5a7685bbf253a0f","index":{"nums":[1,1,0,0,0,0,0],"html_filename":"blog_api_tests_py.html","relative_filename":"blog_api\\tests.py"}},"blog_api_urls_py":{"hash":"f09d68f03286414b85aeac7ef46b526e","index":{"nums":[1,4,0,0,0,0,0],"html_filename":"blog_api_urls_py.html","relative_filename":"blog_api\\urls.py"}},"core___init___py":{"hash":"af9d0d0de0ea3b71d198bc63f1499a7d","index":{"nums":[1,0,0,0,0,0,0],"html_filename":"core___init___py.html","relative_filename":"core\\__init__.py"}},"core_settings_py":{"hash":"e1e7fa848f7f097353e13ef7e8a9e30b","index":{"nums":[1,19,0,0,0,0,0],"html_filename":"core_settings_py.html","relative_filename":"core\\settings.py"}},"core_urls_py":{"hash":"bf68d492820e7f916379b3f7de74ef01","index":{"nums":[1,3,0,0,0,0,0],"html_filename":"core_urls_py.html","relative_filename":"core\\urls.py"}},"manage_py":{"hash":"f8c6d49629b8856f7f764a87376dfe41","index":{"nums":[1,12,0,2,0,0,0],"html_filename":"manage_py.html","relative_filename":"manage.py"}},"blog_api_serializers_py":{"hash":"90d1f2282e1819a425b704c14e315a87","index":{"nums":[1,6,0,0,0,0,0],"html_filename":"blog_api_serializers_py.html","relative_filename":"blog_api\\serializers.py"}},"blog_api_views_py":{"hash":"a0950b25a090b5681ac439519a59bf48","index":{"nums":[1,10,0,0,0,0,0],"html_filename":"blog_api_views_py.html","relative_filename":"blog_api\\views.py"}}}} ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/htmlcov/style.css ================================================ @charset "UTF-8"; /* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ /* For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt */ /* Don't edit this .css file. Edit the .scss file instead! */ html, body, h1, h2, h3, p, table, td, th { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 1em; background: #fff; color: #000; } @media (prefers-color-scheme: dark) { body { background: #1e1e1e; } } @media (prefers-color-scheme: dark) { body { color: #eee; } } html > body { font-size: 16px; } a:active, a:focus { outline: 2px dashed #007acc; } p { font-size: .875em; line-height: 1.4em; } table { border-collapse: collapse; } td { vertical-align: top; } table tr.hidden { display: none !important; } p#no_rows { display: none; font-size: 1.2em; } a.nav { text-decoration: none; color: inherit; } a.nav:hover { text-decoration: underline; color: inherit; } #header { background: #f8f8f8; width: 100%; border-bottom: 1px solid #eee; } @media (prefers-color-scheme: dark) { #header { background: black; } } @media (prefers-color-scheme: dark) { #header { border-color: #333; } } .indexfile #footer { margin: 1rem 3rem; } .pyfile #footer { margin: 1rem 1rem; } #footer .content { padding: 0; color: #666; font-style: italic; } @media (prefers-color-scheme: dark) { #footer .content { color: #aaa; } } #index { margin: 1rem 0 0 3rem; } #header .content { padding: 1rem 3rem; } h1 { font-size: 1.25em; display: inline-block; } #filter_container { float: right; margin: 0 2em 0 0; } #filter_container input { width: 10em; padding: 0.2em 0.5em; border: 2px solid #ccc; background: #fff; color: #000; } @media (prefers-color-scheme: dark) { #filter_container input { border-color: #444; } } @media (prefers-color-scheme: dark) { #filter_container input { background: #1e1e1e; } } @media (prefers-color-scheme: dark) { #filter_container input { color: #eee; } } #filter_container input:focus { border-color: #007acc; } h2.stats { margin-top: .5em; font-size: 1em; } .stats button { font-family: inherit; font-size: inherit; border: 1px solid; border-radius: .2em; color: inherit; padding: .1em .5em; margin: 1px calc(.1em + 1px); cursor: pointer; border-color: #ccc; } @media (prefers-color-scheme: dark) { .stats button { border-color: #444; } } .stats button:active, .stats button:focus { outline: 2px dashed #007acc; } .stats button:active, .stats button:focus { outline: 2px dashed #007acc; } .stats button.run { background: #eeffee; } @media (prefers-color-scheme: dark) { .stats button.run { background: #373d29; } } .stats button.run.show_run { background: #dfd; border: 2px solid #00dd00; margin: 0 .1em; } @media (prefers-color-scheme: dark) { .stats button.run.show_run { background: #373d29; } } .stats button.mis { background: #ffeeee; } @media (prefers-color-scheme: dark) { .stats button.mis { background: #4b1818; } } .stats button.mis.show_mis { background: #fdd; border: 2px solid #ff0000; margin: 0 .1em; } @media (prefers-color-scheme: dark) { .stats button.mis.show_mis { background: #4b1818; } } .stats button.exc { background: #f7f7f7; } @media (prefers-color-scheme: dark) { .stats button.exc { background: #333; } } .stats button.exc.show_exc { background: #eee; border: 2px solid #808080; margin: 0 .1em; } @media (prefers-color-scheme: dark) { .stats button.exc.show_exc { background: #333; } } .stats button.par { background: #ffffd5; } @media (prefers-color-scheme: dark) { .stats button.par { background: #650; } } .stats button.par.show_par { background: #ffa; border: 2px solid #dddd00; margin: 0 .1em; } @media (prefers-color-scheme: dark) { .stats button.par.show_par { background: #650; } } .help_panel, #source p .annotate.long { display: none; position: absolute; z-index: 999; background: #ffffcc; border: 1px solid #888; border-radius: .2em; color: #333; padding: .25em .5em; } #source p .annotate.long { white-space: normal; float: right; top: 1.75em; right: 1em; height: auto; } #keyboard_icon { float: right; margin: 5px; cursor: pointer; } .help_panel { padding: .5em; border: 1px solid #883; } .help_panel .legend { font-style: italic; margin-bottom: 1em; } .indexfile .help_panel { width: 20em; min-height: 4em; } .pyfile .help_panel { width: 16em; min-height: 8em; } #panel_icon { float: right; cursor: pointer; } .keyhelp { margin: .75em; } .keyhelp .key { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em .35em; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: bold; background: #eee; } #source { padding: 1em 0 1em 3rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; } #source p { position: relative; white-space: pre; } #source p * { box-sizing: border-box; } #source p .n { float: left; text-align: right; width: 3rem; box-sizing: border-box; margin-left: -3rem; padding-right: 1em; color: #999; } @media (prefers-color-scheme: dark) { #source p .n { color: #777; } } #source p .n a { text-decoration: none; color: #999; } @media (prefers-color-scheme: dark) { #source p .n a { color: #777; } } #source p .n a:hover { text-decoration: underline; color: #999; } @media (prefers-color-scheme: dark) { #source p .n a:hover { color: #777; } } #source p.highlight .n { background: #ffdd00; } #source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid #fff; } @media (prefers-color-scheme: dark) { #source p .t { border-color: #1e1e1e; } } #source p .t:hover { background: #f2f2f2; } @media (prefers-color-scheme: dark) { #source p .t:hover { background: #282828; } } #source p .t:hover ~ .r .annotate.long { display: block; } #source p .t .com { color: #008000; font-style: italic; line-height: 1px; } @media (prefers-color-scheme: dark) { #source p .t .com { color: #6A9955; } } #source p .t .key { font-weight: bold; line-height: 1px; } #source p .t .str { color: #0451A5; } @media (prefers-color-scheme: dark) { #source p .t .str { color: #9CDCFE; } } #source p.mis .t { border-left: 0.2em solid #ff0000; } #source p.mis.show_mis .t { background: #fdd; } @media (prefers-color-scheme: dark) { #source p.mis.show_mis .t { background: #4b1818; } } #source p.mis.show_mis .t:hover { background: #f2d2d2; } @media (prefers-color-scheme: dark) { #source p.mis.show_mis .t:hover { background: #532323; } } #source p.run .t { border-left: 0.2em solid #00dd00; } #source p.run.show_run .t { background: #dfd; } @media (prefers-color-scheme: dark) { #source p.run.show_run .t { background: #373d29; } } #source p.run.show_run .t:hover { background: #d2f2d2; } @media (prefers-color-scheme: dark) { #source p.run.show_run .t:hover { background: #404633; } } #source p.exc .t { border-left: 0.2em solid #808080; } #source p.exc.show_exc .t { background: #eee; } @media (prefers-color-scheme: dark) { #source p.exc.show_exc .t { background: #333; } } #source p.exc.show_exc .t:hover { background: #e2e2e2; } @media (prefers-color-scheme: dark) { #source p.exc.show_exc .t:hover { background: #3c3c3c; } } #source p.par .t { border-left: 0.2em solid #dddd00; } #source p.par.show_par .t { background: #ffa; } @media (prefers-color-scheme: dark) { #source p.par.show_par .t { background: #650; } } #source p.par.show_par .t:hover { background: #f2f2a2; } @media (prefers-color-scheme: dark) { #source p.par.show_par .t:hover { background: #6d5d0c; } } #source p .r { position: absolute; top: 0; right: 2.5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } #source p .annotate { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #666; padding-right: .5em; } @media (prefers-color-scheme: dark) { #source p .annotate { color: #ddd; } } #source p .annotate.short:hover ~ .long { display: block; } #source p .annotate.long { width: 30em; right: 2.5em; } #source p input { display: none; } #source p input ~ .r label.ctx { cursor: pointer; border-radius: .25em; } #source p input ~ .r label.ctx::before { content: "▶ "; } #source p input ~ .r label.ctx:hover { background: #d5f7ff; color: #666; } @media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { background: #0f3a42; } } @media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { color: #aaa; } } #source p input:checked ~ .r label.ctx { background: #aef; color: #666; border-radius: .75em .75em 0 0; padding: 0 .5em; margin: -.25em 0; } @media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { background: #056; } } @media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { color: #aaa; } } #source p input:checked ~ .r label.ctx::before { content: "▼ "; } #source p input:checked ~ .ctxs { padding: .25em .5em; overflow-y: scroll; max-height: 10.5em; } #source p label.ctx { color: #999; display: inline-block; padding: 0 .5em; font-size: .8333em; } @media (prefers-color-scheme: dark) { #source p label.ctx { color: #777; } } #source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #aef; border-radius: .25em; margin-right: 1.75em; } @media (prefers-color-scheme: dark) { #source p .ctxs { background: #056; } } #source p .ctxs span { display: block; text-align: right; } #index { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.875em; } #index table.index { margin-left: -.5em; } #index td, #index th { text-align: right; width: 5em; padding: .25em .5em; border-bottom: 1px solid #eee; } @media (prefers-color-scheme: dark) { #index td, #index th { border-color: #333; } } #index td.name, #index th.name { text-align: left; width: auto; } #index th { font-style: italic; color: #333; cursor: pointer; } @media (prefers-color-scheme: dark) { #index th { color: #ddd; } } #index th:hover { background: #eee; } @media (prefers-color-scheme: dark) { #index th:hover { background: #333; } } #index th.headerSortDown, #index th.headerSortUp { white-space: nowrap; background: #eee; } @media (prefers-color-scheme: dark) { #index th.headerSortDown, #index th.headerSortUp { background: #333; } } #index th.headerSortDown:after { content: " ↑"; } #index th.headerSortUp:after { content: " ↓"; } #index td.name a { text-decoration: none; color: inherit; } #index tr.total td, #index tr.total_dynamic td { font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; } #index tr.file:hover { background: #eee; } @media (prefers-color-scheme: dark) { #index tr.file:hover { background: #333; } } #index tr.file:hover td.name { text-decoration: underline; color: inherit; } #scroll_marker { position: fixed; right: 0; top: 0; width: 16px; height: 100%; background: #fff; border-left: 1px solid #eee; will-change: transform; } @media (prefers-color-scheme: dark) { #scroll_marker { background: #1e1e1e; } } @media (prefers-color-scheme: dark) { #scroll_marker { border-color: #333; } } #scroll_marker .marker { background: #ccc; position: absolute; min-height: 3px; width: 100%; } @media (prefers-color-scheme: dark) { #scroll_marker .marker { background: #444; } } ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/manage.py ================================================ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/requirements.txt ================================================ asgiref==3.3.4 coverage==5.5 Django==3.2 django-cors-headers==3.7.0 djangorestframework==3.12.4 pytz==2021.1 sqlparse==0.4.1 gunicorn==20.1.0 ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/django/templates/blog/index.html ================================================ //index ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/docker-compose.yml ================================================ version: '3' services: backend: build: context: ./django command: gunicorn core.wsgi --bind 0.0.0.0:8000 ports: - "8000:8000" frontend: build: context: ./react/blogapi volumes: - react_build:/react/build nginx: image: nginx:latest ports: - 80:8080 volumes: - ./nginx/nginx-setup.conf:/etc/nginx/conf.d/default.conf:ro - react_build:/var/www/react depends_on: - backend - frontend volumes: react_build: ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/nginx/nginx-setup.conf ================================================ upstream api { server backend:8000; } server { listen 8080; location / { root /var/www/react; } location /api/ { proxy_pass http://api; proxy_set_header Host $http_host; } } ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/Dockerfile ================================================ FROM node:15.13-alpine WORKDIR /react COPY . . RUN npm run build ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/README.md ================================================ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting ### Analyzing the Bundle Size This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size ### Making a Progressive Web App This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app ### Advanced Configuration This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration ### Deployment This section has moved here: https://facebook.github.io/create-react-app/docs/deployment ### `npm run build` fails to minify This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/package.json ================================================ { "name": "blogapi", "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "^4.11.0", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "^5.2.0", "react-scripts": "3.4.3" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/public/index.html ================================================ React App
================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/App.css ================================================ .App { text-align: center; } .App-logo { height: 40vmin; pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .App-logo { animation: App-logo-spin infinite 20s linear; } } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/App.js ================================================ import React, { useEffect, useState } from 'react'; import './App.css'; import Posts from './components/Posts'; import PostLoadingComponent from './components/PostLoading'; function App() { const PostLoading = PostLoadingComponent(Posts); const [appState, setAppState] = useState({ loading: false, posts: null, }); useEffect(() => { setAppState({ loading: true }); const apiUrl = `http://127.0.0.1/api/`; fetch(apiUrl) .then((data) => data.json()) .then((posts) => { setAppState({ loading: false, posts: posts }); }); }, [setAppState]); return (

Latest Posts

); } export default App; ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/App.test.js ================================================ import React from 'react'; import { render } from '@testing-library/react'; import App from './App'; test('renders learn react link', () => { const { getByText } = render(); const linkElement = getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); }); ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/components/Footer.js ================================================ import React from 'react'; import Container from '@material-ui/core/Container'; import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import Grid from '@material-ui/core/Grid'; import Link from '@material-ui/core/Link'; import Box from '@material-ui/core/Box'; const useStyles = makeStyles((theme) => ({ footer: { borderTop: `1px solid ${theme.palette.divider}`, marginTop: theme.spacing(8), paddingTop: theme.spacing(3), paddingBottom: theme.spacing(3), [theme.breakpoints.up('sm')]: { paddingTop: theme.spacing(6), paddingBottom: theme.spacing(6), }, }, })); function Copyright() { return ( {'Copyright © '} Your Website {' '} {new Date().getFullYear()} {'.'} ); } const footers = [ { title: 'Company', description: ['Team', 'History', 'Contact us', 'Locations'], }, { title: 'Features', description: [ 'Cool stuff', 'Random feature', 'Team feature', 'Developer stuff', 'Another one', ], }, { title: 'Resources', description: [ 'Resource', 'Resource name', 'Another resource', 'Final resource', ], }, { title: 'Legal', description: ['Privacy policy', 'Terms of use'], }, ]; function Footer() { const classes = useStyles(); return ( {footers.map((footer) => ( {footer.title}
    {footer.description.map((item) => (
  • {item}
  • ))}
))}
); } export default Footer; ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/components/Header.js ================================================ import React from 'react'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography'; import CssBaseline from '@material-ui/core/CssBaseline'; import { makeStyles } from '@material-ui/core/styles'; const useStyles = makeStyles((theme) => ({ appBar: { borderBottom: `1px solid ${theme.palette.divider}`, }, })); function Header() { const classes = useStyles(); return ( BlogmeUp ); } export default Header; ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/components/PostLoading.js ================================================ import React from 'react'; function PostLoading(Component) { return function PostLoadingComponent({ isLoading, ...props }) { if (!isLoading) return ; return (

We are waiting for the data to load!...

); }; } export default PostLoading; ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/components/Posts.js ================================================ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; import CardMedia from '@material-ui/core/CardMedia'; import Grid from '@material-ui/core/Grid'; import Typography from '@material-ui/core/Typography'; import Container from '@material-ui/core/Container'; const useStyles = makeStyles((theme) => ({ cardMedia: { paddingTop: '56.25%', // 16:9 }, link: { margin: theme.spacing(1, 1.5), }, cardHeader: { backgroundColor: theme.palette.type === 'light' ? theme.palette.grey[200] : theme.palette.grey[700], }, postTitle: { fontSize: '16px', textAlign: 'left', }, postText: { display: 'flex', justifyContent: 'left', alignItems: 'baseline', fontSize: '12px', textAlign: 'left', marginBottom: theme.spacing(2), }, })); const Posts = (props) => { const { posts } = props; const classes = useStyles(); if (!posts || posts.length === 0) return

Can not find any posts, sorry

; return ( {posts.map((post) => { return ( // Enterprise card is full width at sm breakpoint {post.title.substr(0, 50)}...
{post.excerpt.substr(0, 60)}...
); })}
); }; export default Posts; ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/index.css ================================================ body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Final/react/blogapi/src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import * as serviceWorker from './serviceWorker'; import './index.css'; import { Route, BrowserRouter as Router, Switch } from 'react-router-dom'; import App from './App'; import Header from './components/Header'; import Footer from './components/Footer'; const routing = (