Coverage for blog\__init__.py : 100%
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 ================================================
Edit src/App.js and save to reload.
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
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
5@admin.register(models.Post)
6class AuthorAdmin(admin.ModelAdmin):
7 list_display = ('title', 'id', 'status', 'slug', 'author')
8 prepopulated_fields = {'slug': ('title',), }
11admin.site.register(models.Category)
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
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
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
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
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
5class PostSerializer(serializers.ModelSerializer):
6 class Meta:
7 fields = ('id', 'title', 'author', 'excerpt', 'content', 'status')
8 model = Post
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
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
4app_name = 'blog_api'
6urlpatterns = [
7 path('<int:pk>/', PostDetail.as_view()),
8 path('', PostList.as_view()),
9]
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
6class PostList(generics.ListCreateAPIView):
7 queryset = Post.objects.all()
8 serializer_class = PostSerializer
11class PostDetail(generics.RetrieveDestroyAPIView):
12 queryset = Post.objects.all()
13 serializer_class = PostSerializer
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"""
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
3from django.conf import settings
4from django.db import migrations, models
5import django.db.models.deletion
6import django.utils.timezone
9class Migration(migrations.Migration):
11 initial = True
13 dependencies = [
14 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ]
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 ]
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
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
6class Category(models.Model):
7 name = models.CharField(max_length=100)
9 def __str__(self):
10 return self.name
13class Post(models.Model):
15 class PostObjects(models.Manager):
16 def get_queryset(self):
17 return super().get_queryset() .filter(status='published')
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
37 class Meta:
38 ordering = ('-published',)
40 def __str__(self):
41 return self.title
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
6class Test_Create_Post(TestCase):
8 @classmethod
9 def setUpTestData(cls):
10 test_category = Category.objects.create(name='django')
12 testuser1 = User.objects.create_user(
13 username='test_user1', password='123456789')
14 testuser1.save()
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()
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")
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
4app_name = 'blog'
6urlpatterns = [
7 path('', TemplateView.as_view(template_name="blog/index.html")),
8]
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
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.
4Generated by 'django-admin startproject' using Django 3.1.1.
6For more information on this file, see
7https://docs.djangoproject.com/en/3.1/topics/settings/
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.1/ref/settings/
11"""
13from pathlib import Path
15# Build paths inside the project like this: BASE_DIR / 'subdir'.
16BASE_DIR = Path(__file__).resolve().parent.parent
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
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'
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
28ALLOWED_HOSTS = []
31# Application definition
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]
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]
55ROOT_URLCONF = 'core.urls'
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]
73WSGI_APPLICATION = 'core.wsgi.application'
76# Database
77# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
79DATABASES = {
80 'default': {
81 'ENGINE': 'django.db.backends.sqlite3',
82 'NAME': BASE_DIR / 'db.sqlite3',
83 }
84}
87# Password validation
88# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
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]
106# Internationalization
107# https://docs.djangoproject.com/en/3.1/topics/i18n/
109LANGUAGE_CODE = 'en-us'
111TIME_ZONE = 'UTC'
113USE_I18N = True
115USE_L10N = True
117USE_TZ = True
120# Static files (CSS, JavaScript, Images)
121# https://docs.djangoproject.com/en/3.1/howto/static-files/
123STATIC_URL = '/static/'
126REST_FRAMEWORK = {
127 'DEFAULT_PERMISSION_CLASSES': [
128 'rest_framework.permissions.AllowAny',
129 ]
130}
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
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
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]
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.
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
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)
21if __name__ == '__main__':
22 main()
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) returnCan not find any posts, sorry
; return (
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
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
5@admin.register(models.Post)
6class AuthorAdmin(admin.ModelAdmin):
7 list_display = ('title', 'id', 'status', 'slug', 'author')
8 prepopulated_fields = {'slug': ('title',), }
11admin.site.register(models.Category)
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
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
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
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
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
5class PostSerializer(serializers.ModelSerializer):
6 class Meta:
7 fields = ('id', 'title', 'author', 'excerpt', 'content', 'status')
8 model = Post
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
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
4app_name = 'blog_api'
6urlpatterns = [
7 path('<int:pk>/', PostDetail.as_view()),
8 path('', PostList.as_view()),
9]
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
6class PostList(generics.ListCreateAPIView):
7 queryset = Post.objects.all()
8 serializer_class = PostSerializer
11class PostDetail(generics.RetrieveDestroyAPIView):
12 queryset = Post.objects.all()
13 serializer_class = PostSerializer
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"""
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
3from django.conf import settings
4from django.db import migrations, models
5import django.db.models.deletion
6import django.utils.timezone
9class Migration(migrations.Migration):
11 initial = True
13 dependencies = [
14 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ]
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 ]
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
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
6class Category(models.Model):
7 name = models.CharField(max_length=100)
9 def __str__(self):
10 return self.name
13class Post(models.Model):
15 class PostObjects(models.Manager):
16 def get_queryset(self):
17 return super().get_queryset() .filter(status='published')
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
37 class Meta:
38 ordering = ('-published',)
40 def __str__(self):
41 return self.title
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
6class Test_Create_Post(TestCase):
8 @classmethod
9 def setUpTestData(cls):
10 test_category = Category.objects.create(name='django')
12 testuser1 = User.objects.create_user(
13 username='test_user1', password='123456789')
14 testuser1.save()
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()
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")
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
4app_name = 'blog'
6urlpatterns = [
7 path('', TemplateView.as_view(template_name="blog/index.html")),
8]
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
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.
4Generated by 'django-admin startproject' using Django 3.1.1.
6For more information on this file, see
7https://docs.djangoproject.com/en/3.1/topics/settings/
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.1/ref/settings/
11"""
13from pathlib import Path
15# Build paths inside the project like this: BASE_DIR / 'subdir'.
16BASE_DIR = Path(__file__).resolve().parent.parent
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
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'
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
28ALLOWED_HOSTS = []
31# Application definition
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]
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]
55ROOT_URLCONF = 'core.urls'
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]
73WSGI_APPLICATION = 'core.wsgi.application'
76# Database
77# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
79DATABASES = {
80 'default': {
81 'ENGINE': 'django.db.backends.sqlite3',
82 'NAME': BASE_DIR / 'db.sqlite3',
83 }
84}
87# Password validation
88# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
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]
106# Internationalization
107# https://docs.djangoproject.com/en/3.1/topics/i18n/
109LANGUAGE_CODE = 'en-us'
111TIME_ZONE = 'UTC'
113USE_I18N = True
115USE_L10N = True
117USE_TZ = True
120# Static files (CSS, JavaScript, Images)
121# https://docs.djangoproject.com/en/3.1/howto/static-files/
123STATIC_URL = '/static/'
126REST_FRAMEWORK = {
127 'DEFAULT_PERMISSION_CLASSES': [
128 'rest_framework.permissions.AllowAny',
129 ]
130}
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
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
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]
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.
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
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)
21if __name__ == '__main__':
22 main()
We are waiting for the data to load!...
); }; } export default PostLoading; ================================================ FILE: Part-6 Nginx React and Django Gunicorn/Starting Repository/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) returnCan not find any posts, sorry
; return (