├── .gitignore ├── LICENSE ├── README.md ├── dj-integrate.sublime-project ├── dj-integrate.sublime-workspace └── src ├── Procfile ├── cfehome ├── __init__.py ├── settings │ ├── __init__.py │ ├── base.py │ ├── local.py │ └── production.py ├── urls.py └── wsgi.py ├── db.sqlite3 ├── manage.py ├── pages ├── __init__.py ├── admin.py ├── apps.py ├── migrations │ └── __init__.py ├── models.py ├── templates │ └── pages │ │ └── front-end-render.html ├── tests.py └── views.py ├── products ├── __init__.py ├── admin.py ├── api │ ├── serializers.py │ ├── urls.py │ └── views.py ├── apps.py ├── migrations │ ├── 0001_initial.py │ └── __init__.py ├── models.py ├── tests.py └── views.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | 3 | # Virtualenv related 4 | bin/ 5 | include/ 6 | pip-selfcheck.json 7 | 8 | # Django related 9 | # src//settings/local.py 10 | # static-cdn/ # any collected static files 11 | 12 | 13 | # Byte-compiled / optimized / DLL files 14 | __pycache__/ 15 | *.py[cod] 16 | *$py.class 17 | 18 | # C extensions 19 | *.so 20 | 21 | # Distribution / packaging 22 | .Python 23 | build/ 24 | develop-eggs/ 25 | dist/ 26 | downloads/ 27 | eggs/ 28 | .eggs/ 29 | lib/ 30 | lib64/ 31 | parts/ 32 | sdist/ 33 | var/ 34 | wheels/ 35 | *.egg-info/ 36 | .installed.cfg 37 | *.egg 38 | 39 | # PyInstaller 40 | # Usually these files are written by a python script from a template 41 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 42 | *.manifest 43 | *.spec 44 | 45 | # Installer logs 46 | pip-log.txt 47 | pip-delete-this-directory.txt 48 | 49 | # Unit test / coverage reports 50 | htmlcov/ 51 | .tox/ 52 | .coverage 53 | .coverage.* 54 | .cache 55 | nosetests.xml 56 | coverage.xml 57 | *.cover 58 | .hypothesis/ 59 | 60 | # Translations 61 | *.mo 62 | *.pot 63 | 64 | # Django stuff: 65 | *.log 66 | local_settings.py 67 | 68 | # Flask stuff: 69 | instance/ 70 | .webassets-cache 71 | 72 | # Scrapy stuff: 73 | .scrapy 74 | 75 | # Sphinx documentation 76 | docs/_build/ 77 | 78 | # PyBuilder 79 | target/ 80 | 81 | # Jupyter Notebook 82 | .ipynb_checkpoints 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # celery beat schedule file 88 | celerybeat-schedule 89 | 90 | # SageMath parsed files 91 | *.sage.py 92 | 93 | # Environments 94 | .env 95 | .venv 96 | env/ 97 | venv/ 98 | ENV/ 99 | 100 | # Spyder project settings 101 | .spyderproject 102 | .spyproject 103 | 104 | # Rope project settings 105 | .ropeproject 106 | 107 | # mkdocs documentation 108 | /site 109 | 110 | # mypy 111 | .mypy_cache/ 112 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Coding For Entrepreneurs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Django JS Frontend Integration 2 | 3 | This tutorial shows you the basics of how to integrate Angular, React, Vue, or any other JavaScript front end you'd like. -------------------------------------------------------------------------------- /dj-integrate.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /dj-integrate.sublime-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "auto_complete": 3 | { 4 | "selected_items": 5 | [ 6 | [ 7 | "get_", 8 | "get_recent_status" 9 | ], 10 | [ 11 | "Stat", 12 | "Status" 13 | ], 14 | [ 15 | "ser", 16 | "serializer_class" 17 | ], 18 | [ 19 | "file", 20 | "file_data" 21 | ], 22 | [ 23 | "get", 24 | "get_serializer_context" 25 | ], 26 | [ 27 | "us", 28 | "username" 29 | ], 30 | [ 31 | "valid", 32 | "validated_data" 33 | ], 34 | [ 35 | "pass", 36 | "password2" 37 | ], 38 | [ 39 | "User", 40 | "UserRegisterSerializer" 41 | ], 42 | [ 43 | "se", 44 | "serializers" 45 | ], 46 | [ 47 | "pas", 48 | "password2" 49 | ], 50 | [ 51 | "aut", 52 | "authenticated" 53 | ], 54 | [ 55 | "res", 56 | "rest_framework" 57 | ], 58 | [ 59 | "t", 60 | "timezone" 61 | ], 62 | [ 63 | "jw", 64 | "jwt_response_payload_handler" 65 | ], 66 | [ 67 | "json", 68 | "json_str" 69 | ], 70 | [ 71 | "b", 72 | "b64encode" 73 | ], 74 | [ 75 | "per", 76 | "permissions" 77 | ], 78 | [ 79 | "au", 80 | "authentication_classes" 81 | ], 82 | [ 83 | "cont", 84 | "Content-Type" 85 | ], 86 | [ 87 | "pos", 88 | "post_data" 89 | ], 90 | [ 91 | "post", 92 | "post_method" 93 | ], 94 | [ 95 | "content", 96 | "content-type" 97 | ], 98 | [ 99 | "po", 100 | "post_data" 101 | ], 102 | [ 103 | "img", 104 | "image_path" 105 | ], 106 | [ 107 | "do", 108 | "do_img" 109 | ], 110 | [ 111 | "bod", 112 | "body_" 113 | ], 114 | [ 115 | "query", 116 | "query_get" 117 | ], 118 | [ 119 | "quer", 120 | "query_body" 121 | ], 122 | [ 123 | "gene", 124 | "generics" 125 | ], 126 | [ 127 | "sa", 128 | "serializer" 129 | ], 130 | [ 131 | "s", 132 | "serializers" 133 | ], 134 | [ 135 | "clea", 136 | "cleaned_data" 137 | ], 138 | [ 139 | "St", 140 | "StatusForm" 141 | ], 142 | [ 143 | "staut", 144 | "StatusForm" 145 | ], 146 | [ 147 | "passed", 148 | "passed_id" 149 | ], 150 | [ 151 | "de", 152 | "deleted_" 153 | ], 154 | [ 155 | "sav", 156 | "saved_data" 157 | ], 158 | [ 159 | "is", 160 | "is_json" 161 | ], 162 | [ 163 | "form", 164 | "form_data" 165 | ], 166 | [ 167 | "err", 168 | "error_data" 169 | ], 170 | [ 171 | "Updat", 172 | "UpdateModel" 173 | ], 174 | [ 175 | "Up", 176 | "UpdateModel" 177 | ], 178 | [ 179 | "Mo", 180 | "UpdateModelForm" 181 | ], 182 | [ 183 | "crf", 184 | "csrf_exempt" 185 | ], 186 | [ 187 | "new", 188 | "new_data" 189 | ], 190 | [ 191 | "st", 192 | "status_code" 193 | ], 194 | [ 195 | "lis", 196 | "list_values" 197 | ], 198 | [ 199 | "js", 200 | "json" 201 | ], 202 | [ 203 | "render", 204 | "render_to_json_response" 205 | ], 206 | [ 207 | "con", 208 | "context" 209 | ], 210 | [ 211 | "re", 212 | "render" 213 | ], 214 | [ 215 | "Char", 216 | "ChargeManager" 217 | ], 218 | [ 219 | "stri", 220 | "stripe_charge" 221 | ], 222 | [ 223 | "strip", 224 | "stripe_charge" 225 | ], 226 | [ 227 | "card", 228 | "card_obj" 229 | ], 230 | [ 231 | "or", 232 | "other_ids" 233 | ], 234 | [ 235 | "sess", 236 | "session_key" 237 | ], 238 | [ 239 | "Login", 240 | "LoginForm" 241 | ], 242 | [ 243 | "full", 244 | "full_name" 245 | ], 246 | [ 247 | "is_", 248 | "is_staff" 249 | ], 250 | [ 251 | "user", 252 | "user_obj" 253 | ], 254 | [ 255 | "auto_", 256 | "auto_now_add" 257 | ], 258 | [ 259 | "add", 260 | "address_line_2" 261 | ], 262 | [ 263 | "line", 264 | "line1" 265 | ], 266 | [ 267 | "ship", 268 | "shipping_address" 269 | ], 270 | [ 271 | "bil", 272 | "billing_address_id" 273 | ], 274 | [ 275 | "Bil", 276 | "BillingProfile" 277 | ], 278 | [ 279 | "Bill", 280 | "BillingProfileManager" 281 | ], 282 | [ 283 | "obj", 284 | "order_obj" 285 | ], 286 | [ 287 | "order", 288 | "order_obj" 289 | ], 290 | [ 291 | "billing", 292 | "billing_profile" 293 | ], 294 | [ 295 | "car", 296 | "cart_removal_qs" 297 | ], 298 | [ 299 | "gues", 300 | "guest_email_id" 301 | ], 302 | [ 303 | "cl", 304 | "cleaned_data" 305 | ], 306 | [ 307 | "bill", 308 | "billing_profile" 309 | ], 310 | [ 311 | "next", 312 | "next_post" 313 | ], 314 | [ 315 | "nu", 316 | "num1" 317 | ], 318 | [ 319 | "cart", 320 | "cart_obj" 321 | ], 322 | [ 323 | "ran", 324 | "random_string_generator" 325 | ], 326 | [ 327 | "pr", 328 | "product_id" 329 | ], 330 | [ 331 | "Pr", 332 | "ProductDetailSlugView" 333 | ], 334 | [ 335 | "prd", 336 | "product_id" 337 | ], 338 | [ 339 | "Car", 340 | "CartManager" 341 | ], 342 | [ 343 | "tag", 344 | "tag_set" 345 | ], 346 | [ 347 | "drop", 348 | "dropdown-menu" 349 | ], 350 | [ 351 | "nav", 352 | "navbar" 353 | ], 354 | [ 355 | "fea", 356 | "featured" 357 | ], 358 | [ 359 | "conta", 360 | "contact_form" 361 | ], 362 | [ 363 | "mar", 364 | "margin-bottom" 365 | ], 366 | [ 367 | "en", 368 | "environ" 369 | ], 370 | [ 371 | "image", 372 | "image_path" 373 | ], 374 | [ 375 | "in", 376 | "instanceof\tkeyword" 377 | ], 378 | [ 379 | "Vid", 380 | "VideoManager" 381 | ], 382 | [ 383 | "Vide", 384 | "VideoQuerySet" 385 | ], 386 | [ 387 | "q", 388 | "query" 389 | ], 390 | [ 391 | "u", 392 | "unique_slug_generator" 393 | ], 394 | [ 395 | "col-", 396 | "col-sm-12" 397 | ], 398 | [ 399 | "h", 400 | "homeImageList\tproperty" 401 | ], 402 | [ 403 | "r", 404 | "routeSub\tproperty" 405 | ], 406 | [ 407 | "Av", 408 | "ActivatedRoute\talias" 409 | ], 410 | [ 411 | "p", 412 | "push\tmethod" 413 | ], 414 | [ 415 | "max", 416 | "max-height" 417 | ], 418 | [ 419 | "margin-", 420 | "margin-bottom" 421 | ], 422 | [ 423 | "min", 424 | "min-height" 425 | ], 426 | [ 427 | "by", 428 | "bypassSecurityTrustResourceUrl\tmethod" 429 | ], 430 | [ 431 | "Pip", 432 | "PipeTransform\talias" 433 | ], 434 | [ 435 | "imp", 436 | "implements\tkeyword" 437 | ], 438 | [ 439 | "cons", 440 | "console\tvar" 441 | ], 442 | [ 443 | "rou", 444 | "RouterModule\talias" 445 | ], 446 | [ 447 | "Rou", 448 | "RouterModule\talias" 449 | ], 450 | [ 451 | "fu", 452 | "function\tkeyword" 453 | ], 454 | [ 455 | "bas", 456 | "basil3\tlet" 457 | ], 458 | [ 459 | "login", 460 | "loginUrl" 461 | ], 462 | [ 463 | "lo", 464 | "login" 465 | ], 466 | [ 467 | "data", 468 | "dataId" 469 | ], 470 | [ 471 | "gen", 472 | "generateEditForm" 473 | ], 474 | [ 475 | "cfe-", 476 | "cfe-media-edit" 477 | ], 478 | [ 479 | "auth", 480 | "author" 481 | ], 482 | [ 483 | "text", 484 | "textarea" 485 | ], 486 | [ 487 | "object", 488 | "objectId" 489 | ], 490 | [ 491 | "co", 492 | "contentTxt" 493 | ], 494 | [ 495 | "html", 496 | "htmlStart_" 497 | ], 498 | [ 499 | "a", 500 | "authentication" 501 | ], 502 | [ 503 | "fo", 504 | "formResponse" 505 | ], 506 | [ 507 | "max-", 508 | "max-height" 509 | ], 510 | [ 511 | "time", 512 | "timestamp" 513 | ], 514 | [ 515 | "like", 516 | "likeUrl" 517 | ] 518 | ] 519 | }, 520 | "buffers": 521 | [ 522 | { 523 | "settings": 524 | { 525 | "buffer_size": 0, 526 | "line_ending": "Unix" 527 | } 528 | }, 529 | { 530 | "file": ".gitignore", 531 | "settings": 532 | { 533 | "buffer_size": 1318, 534 | "encoding": "UTF-8", 535 | "line_ending": "Unix" 536 | } 537 | } 538 | ], 539 | "build_system": "", 540 | "build_system_choices": 541 | [ 542 | ], 543 | "build_varint": "", 544 | "command_palette": 545 | { 546 | "height": 87.0, 547 | "last_filter": "mark", 548 | "selected_items": 549 | [ 550 | [ 551 | "mark", 552 | "Markdown Preview: Preview in Browser" 553 | ], 554 | [ 555 | "instal", 556 | "Package Control: Install Package" 557 | ], 558 | [ 559 | "ins", 560 | "Package Control: Install Package" 561 | ], 562 | [ 563 | "pack", 564 | "Package Control: Install Package" 565 | ], 566 | [ 567 | "mar", 568 | "Markdown Preview: Preview in Browser" 569 | ], 570 | [ 571 | "markd", 572 | "Markdown Preview: Preview in Browser" 573 | ], 574 | [ 575 | "markdown", 576 | "Markdown Preview: Preview in Browser" 577 | ], 578 | [ 579 | "", 580 | "Convert Case: Lower Case" 581 | ], 582 | [ 583 | "package", 584 | "Package Control: List Packages" 585 | ], 586 | [ 587 | "install", 588 | "Package Control: Install Package" 589 | ] 590 | ], 591 | "width": 485.0 592 | }, 593 | "console": 594 | { 595 | "height": 125.0, 596 | "history": 597 | [ 598 | ] 599 | }, 600 | "distraction_free": 601 | { 602 | "menu_visible": true, 603 | "show_minimap": false, 604 | "show_open_files": false, 605 | "show_tabs": false, 606 | "side_bar_visible": false, 607 | "status_bar_visible": false 608 | }, 609 | "expanded_folders": 610 | [ 611 | "/Users/cfe/Dev/dj-integrate", 612 | "/Users/cfe/Dev/dj-integrate/src" 613 | ], 614 | "file_history": 615 | [ 616 | "/Users/cfe/Dev/dj-integrate/dj-integrate.sublime-project", 617 | "/Users/cfe/Dropbox/CFE Projects/tests/client/cfe-rest-client/package.json", 618 | "/Users/cfe/Dropbox/CFE Projects/tests/src/cfeapi/settings.py", 619 | "/Users/cfe/Dropbox/CFE Projects/tests/client/cfe-rest-client/src/app/status-create/status-create.component.html", 620 | "/Users/cfe/Dropbox/CFE Projects/tests/client/cfe-rest-client/src/app/status-create/status-create.component.ts", 621 | "/Users/cfe/Dropbox/CFE Projects/tests/client/cfe-rest-client/src/app/app-routing.module.ts", 622 | "/Users/cfe/Dropbox/CFE Projects/tests/client/cfe-rest-client/src/app/status-detail/status-detail.component.ts", 623 | "/Volumes/CFE/CFE Projects/Current/Rest API/Sections/3 - Django Rest Framework API/Tests/test_rest_api.py", 624 | "/Users/cfe/Dev/restapi/src/accounts/api/permissions.py", 625 | "/Users/cfe/Dev/restapi/src/status/api/views.py", 626 | "/Users/cfe/Dev/restapi/src/status/api/serializers.py", 627 | "/Users/cfe/Dev/restapi/src/status/api/urls.py", 628 | "/Users/cfe/Dev/restapi/src/status/models.py", 629 | "/Users/cfe/Dev/restapi/scripts/cfe_rest_framework_api.py", 630 | "/Users/cfe/Dev/restapi/src/accounts/api/views.py", 631 | "/Users/cfe/Dev/restapi/src/accounts/api/serializers.py", 632 | "/Users/cfe/Dev/restapi/src/accounts/api/user/__init__.py", 633 | "/Users/cfe/Dev/restapi/src/accounts/api/user/urls.py", 634 | "/Users/cfe/Dev/restapi/src/accounts/api/user/serializers.py", 635 | "/Users/cfe/Dev/restapi/src/accounts/api/urls.py", 636 | "/Users/cfe/Dev/restapi/src/cfeapi/urls.py", 637 | "/Users/cfe/Dev/restapi/src/accounts/api/user/views.py", 638 | "/Users/cfe/Dev/restapi/src/cfeapi/restconf/pagination.py", 639 | "/Users/cfe/Dev/restapi/src/accounts/api/urls_user.py", 640 | "/Users/cfe/Dev/restapi/README.md", 641 | "/Users/cfe/Dev/restapi/parsed_log.md", 642 | "/Users/cfe/Dev/restapi/src/cfeapi/settings.py", 643 | "/Users/cfe/Dev/restapi/src/accounts/api/__init__.py", 644 | "/Users/cfe/Dev/restapi/src/accounts/api/utils.py", 645 | "/Users/cfe/Dev/restapi/src/cfeapi/restconf/__init__.py", 646 | "/Users/cfe/Dev/restapi/scripts/cfe_pure_api.py", 647 | "/Users/cfe/Dev/restapi/.gitignore", 648 | "/Users/cfe/Dev/restapi/static-server/media-root/status/readme.txt", 649 | "/Users/cfe/Dev/restapi/src/updates/api/views.py", 650 | "/Users/cfe/Dev/restapi/src/status/api/shell_examples.py", 651 | "/Users/cfe/Dev/restapi/src/status/forms.py", 652 | "/Users/cfe/Dev/restapi/src/status/admin.py", 653 | "/Users/cfe/Dev/restapi/src/status/api/__init__.py", 654 | "/Users/cfe/Dev/restapi/src/updates/views.py", 655 | "/Users/cfe/Dev/restapi/src/status/serializers.py", 656 | "/Users/cfe/Dev/restapi/src/updates/models.py", 657 | "/Users/cfe/Dev/restapi/src/updates/forms.py", 658 | "/Users/cfe/Dev/restapi/LICENSE", 659 | "/Users/cfe/Dev/restapi/src/updates/api/utils.py", 660 | "/Users/cfe/Dev/restapi/src/updates/api/urls.py", 661 | "/Users/cfe/Dev/restapi/src/updates/api/mixins.py", 662 | "/Users/cfe/Dev/restapi/src/cfeapi/mixins.py", 663 | "/Users/cfe/Dev/restapi/lib/python3.6/site-packages/django/http/response.py", 664 | "/Users/cfe/Dev/restapi/scripts/api_detail.py", 665 | "/Users/cfe/Dev/restapi/src/updates/admin.py", 666 | "/Users/cfe/Dev/restapi/src/updates/api/__init__.py", 667 | "/Users/cfe/Documents/notes_delete.js", 668 | "/Users/cfe/Dropbox/CFE Projects/Blog/Articles/Custom-Analytics-with-Django.md", 669 | "/Users/cfe/Desktop/notes_delete/stripe_notes.py", 670 | "/Users/cfe/Desktop/notes_delete/code.py", 671 | "/Users/cfe/Dev/ecommerce/src/accounts/forms.py", 672 | "/Users/cfe/Dev/ecommerce/src/accounts/admin.py", 673 | "/Users/cfe/Dev/ecommerce/src/ecommerce/urls.py", 674 | "/Users/cfe/Dev/ecommerce/src/ecommerce/settings.py", 675 | "/Users/cfe/Dev/ecommerce/src/accounts/models.py", 676 | "/Users/cfe/Dev/ecommerce/src/accounts/views.py", 677 | "/Users/cfe/Dev/ecommerce/README.md", 678 | "/Users/cfe/Dev/ecommerce/parsed_log.md", 679 | "/Users/cfe/Dev/ecommerce/notes/checkout_process.md", 680 | "/Users/cfe/Dev/ecommerce/src/ecommerce/utils.py", 681 | "/Users/cfe/Dev/ecommerce/src/addresses/admin.py", 682 | "/Users/cfe/Dev/ecommerce/src/addresses/forms.py", 683 | "/Users/cfe/Dev/ecommerce/src/addresses/models.py", 684 | "/Users/cfe/Dev/ecommerce/src/billing/models.py", 685 | "/Users/cfe/Dev/ecommerce/src/addresses/templates/addresses/form.html", 686 | "/Users/cfe/Dev/ecommerce/src/addresses/views.py", 687 | "/Users/cfe/Dev/ecommerce/src/orders/models.py", 688 | "/Users/cfe/Dev/ecommerce/src/addresses/templates/addresses/prev_addresses.html", 689 | "/Users/cfe/Dev/ecommerce/src/carts/templates/carts/checkout.html", 690 | "/Users/cfe/Dev/ecommerce/src/carts/templates/carts/checkout-done.html", 691 | "/Users/cfe/Dev/ecommerce/src/carts/urls.py", 692 | "/Users/cfe/Dev/ecommerce/parse_git_log.py", 693 | "/Users/cfe/Dev/ecommerce/src/carts/views.py", 694 | "/Users/cfe/Dev/ecommerce/src/billing/admin.py", 695 | "/Users/cfe/Dev/ecommerce/src/accounts/templates/accounts/snippets/form.html", 696 | "/Users/cfe/Dev/ecommerce/src/ecommerce/views.py", 697 | "/Users/cfe/Dev/ecommerce/src/templates/base/navbar.html", 698 | "/Users/cfe/Dev/ecommerce/src/ecommerce/forms.py", 699 | "/Users/cfe/Dev/ecommerce/src/templates/auth/login.html", 700 | "/Users/cfe/Dev/ecommerce/src/carts/models.py", 701 | "/Users/cfe/Dev/ecommerce/src/products/models.py", 702 | "/Users/cfe/Dev/ecommerce/src/tags/models.py", 703 | "/Users/cfe/Dev/ecommerce/src/orders/admin.py", 704 | "/Users/cfe/Dev/ecommerce/src/carts/templates/carts/home.html", 705 | "/Users/cfe/Dev/ecommerce/src/products/utils.py", 706 | "/Users/cfe/Dev/ecommerce/src/orders/utils.py", 707 | "/Users/cfe/Dev/ecommerce/src/templates/base/css.html", 708 | "/Users/cfe/Dev/ecommerce/src/products/views.py", 709 | "/Users/cfe/Dev/ecommerce/src/products/templates/products/detail.html", 710 | "/Users/cfe/Dev/ecommerce/src/products/templates/products/snippets/update-cart.html", 711 | "/Users/cfe/Dev/ecommerce/src/carts/admin.py", 712 | "/Users/cfe/Dev/ecommerce/src/search/urls.py", 713 | "/Users/cfe/Dev/ecommerce/src/tags/admin.py", 714 | "/Users/cfe/Dev/ecommerce/src/tags/shell_commands.py", 715 | "/Users/cfe/Dev/ecommerce/src/search/templates/search/view.html", 716 | "/Users/cfe/Dev/ecommerce/src/search/templates/search/snippets/search-form.html", 717 | "/Users/cfe/Dev/ecommerce/src/search/views.py", 718 | "/Users/cfe/Dev/ecommerce/src/search/models.py", 719 | "/Users/cfe/Dev/ecommerce/src/search/templates/search/search_form.html", 720 | "/Users/cfe/Dev/ecommerce/src/templates/bootstrap/example.html", 721 | "/Users/cfe/Dev/ecommerce/src/templates/base.html", 722 | "/Users/cfe/Dev/ecommerce/src/templates/home_page.html", 723 | "/Users/cfe/Dev/ecommerce/src/products/templates/products/list.html", 724 | "/Users/cfe/Dev/ecommerce/src/templates/auth/register.html", 725 | "/Users/cfe/Dev/ecommerce/src/templates/bootstrap-section/base.html", 726 | "/Users/cfe/Dev/ecommerce/src/templates/contact/view.html", 727 | "/Users/cfe/Dev/ecommerce/src/products/urls.py", 728 | "/Users/cfe/Dev/ecommerce/src/products/templates/products/snippets/card.html", 729 | "/Users/cfe/Dev/ecommerce/src/products/admin.py", 730 | "/Users/cfe/Dev/ecommerce/src/templates/base/js.html", 731 | "/Users/cfe/Dev/ecommerce/src/products/templates/products/featured-detail.html", 732 | "/Users/cfe/Dev/ecommerce/src/products/understanding_crud.md", 733 | "/Users/cfe/Dev/ecommerce/src/static_my_proj/css/main.css", 734 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/templates/upload.html", 735 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/cfehome/urls.py", 736 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/files/config_aws.py", 737 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/cfehome/settings/base.py", 738 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/cfehome/settings/local.py", 739 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/cfehome/settings/production.py", 740 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/credentials.py", 741 | "/Users/cfe/Dev/cfe-s3-upload/backend/src/cfehome/credentials.py", 742 | "/Users/cfe/Dev/django-s3-upload/credentials.py", 743 | "/Users/cfe/Dev/django-s3-upload/src/credentials.py" 744 | ], 745 | "find": 746 | { 747 | "height": 44.0 748 | }, 749 | "find_in_files": 750 | { 751 | "height": 132.0, 752 | "where_history": 753 | [ 754 | ] 755 | }, 756 | "find_state": 757 | { 758 | "case_sensitive": false, 759 | "find_history": 760 | [ 761 | "formDir" 762 | ], 763 | "highlight": false, 764 | "in_selection": false, 765 | "preserve_case": false, 766 | "regex": false, 767 | "replace_history": 768 | [ 769 | ], 770 | "reverse": false, 771 | "show_context": false, 772 | "use_buffer2": false, 773 | "whole_word": false, 774 | "wrap": true 775 | }, 776 | "groups": 777 | [ 778 | { 779 | "selected": 0, 780 | "sheets": 781 | [ 782 | { 783 | "buffer": 0, 784 | "semi_transient": false, 785 | "settings": 786 | { 787 | "buffer_size": 0, 788 | "regions": 789 | { 790 | }, 791 | "selection": 792 | [ 793 | [ 794 | 0, 795 | 0 796 | ] 797 | ], 798 | "settings": 799 | { 800 | "syntax": "Packages/Text/Plain text.tmLanguage" 801 | }, 802 | "translation.x": 0.0, 803 | "translation.y": 0.0, 804 | "zoom_level": 1.0 805 | }, 806 | "stack_index": 0, 807 | "type": "text" 808 | }, 809 | { 810 | "buffer": 1, 811 | "file": ".gitignore", 812 | "semi_transient": false, 813 | "settings": 814 | { 815 | "buffer_size": 1318, 816 | "regions": 817 | { 818 | }, 819 | "selection": 820 | [ 821 | [ 822 | 1318, 823 | 1318 824 | ] 825 | ], 826 | "settings": 827 | { 828 | "syntax": "Packages/Text/Plain text.tmLanguage" 829 | }, 830 | "translation.x": 0.0, 831 | "translation.y": 0.0, 832 | "zoom_level": 1.0 833 | }, 834 | "stack_index": 1, 835 | "type": "text" 836 | } 837 | ] 838 | } 839 | ], 840 | "incremental_find": 841 | { 842 | "height": 44.0 843 | }, 844 | "input": 845 | { 846 | "height": 56.0 847 | }, 848 | "layout": 849 | { 850 | "cells": 851 | [ 852 | [ 853 | 0, 854 | 0, 855 | 1, 856 | 1 857 | ] 858 | ], 859 | "cols": 860 | [ 861 | 0.0, 862 | 1.0 863 | ], 864 | "rows": 865 | [ 866 | 0.0, 867 | 1.0 868 | ] 869 | }, 870 | "menu_visible": true, 871 | "output.doc": 872 | { 873 | "height": 0.0 874 | }, 875 | "output.find_results": 876 | { 877 | "height": 508.0 878 | }, 879 | "pinned_build_system": "", 880 | "project": "dj-integrate.sublime-project", 881 | "replace": 882 | { 883 | "height": 84.0 884 | }, 885 | "save_all_on_build": true, 886 | "select_file": 887 | { 888 | "height": 0.0, 889 | "last_filter": "", 890 | "selected_items": 891 | [ 892 | [ 893 | "email", 894 | "templates/team/email_instructions.html" 895 | ] 896 | ], 897 | "width": 0.0 898 | }, 899 | "select_project": 900 | { 901 | "height": 0.0, 902 | "last_filter": "", 903 | "selected_items": 904 | [ 905 | ], 906 | "width": 0.0 907 | }, 908 | "select_symbol": 909 | { 910 | "height": 0.0, 911 | "last_filter": "", 912 | "selected_items": 913 | [ 914 | ], 915 | "width": 0.0 916 | }, 917 | "selected_group": 0, 918 | "settings": 919 | { 920 | }, 921 | "show_minimap": false, 922 | "show_open_files": true, 923 | "show_tabs": true, 924 | "side_bar_visible": true, 925 | "side_bar_width": 405.0, 926 | "status_bar_visible": true, 927 | "template_settings": 928 | { 929 | } 930 | } 931 | -------------------------------------------------------------------------------- /src/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn cfe.wsgi --log-file - 2 | -------------------------------------------------------------------------------- /src/cfehome/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingforentrepreneurs/Django-JS-Frontend-Integration/ae5379766b2327738e0c23ff044ae550fd44cc2d/src/cfehome/__init__.py -------------------------------------------------------------------------------- /src/cfehome/settings/__init__.py: -------------------------------------------------------------------------------- 1 | from .base import * 2 | 3 | from .production import * 4 | 5 | try: 6 | from .local import * 7 | except: 8 | pass 9 | 10 | -------------------------------------------------------------------------------- /src/cfehome/settings/base.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for cfehome project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.11.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.11/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'o!uew-zq*&u50p#09e9t_%xb+cr(8$ju_8y&c$@kdo%cf@4=6@' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_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 | 41 | 'rest_framework', 42 | 'pages', 43 | 'products' 44 | ] 45 | 46 | MIDDLEWARE = [ 47 | 'django.middleware.security.SecurityMiddleware', 48 | 'django.contrib.sessions.middleware.SessionMiddleware', 49 | 'django.middleware.common.CommonMiddleware', 50 | 'django.middleware.csrf.CsrfViewMiddleware', 51 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 52 | 'django.contrib.messages.middleware.MessageMiddleware', 53 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 54 | ] 55 | 56 | ROOT_URLCONF = 'cfehome.urls' 57 | 58 | TEMPLATES = [ 59 | { 60 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 61 | 'DIRS': [], 62 | 'APP_DIRS': True, 63 | 'OPTIONS': { 64 | 'context_processors': [ 65 | 'django.template.context_processors.debug', 66 | 'django.template.context_processors.request', 67 | 'django.contrib.auth.context_processors.auth', 68 | 'django.contrib.messages.context_processors.messages', 69 | ], 70 | }, 71 | }, 72 | ] 73 | 74 | WSGI_APPLICATION = 'cfehome.wsgi.application' 75 | 76 | 77 | # Database 78 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases 79 | 80 | DATABASES = { 81 | 'default': { 82 | 'ENGINE': 'django.db.backends.sqlite3', 83 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 84 | } 85 | } 86 | 87 | 88 | # Password validation 89 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 90 | 91 | AUTH_PASSWORD_VALIDATORS = [ 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 100 | }, 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 103 | }, 104 | ] 105 | 106 | 107 | # Internationalization 108 | # https://docs.djangoproject.com/en/1.11/topics/i18n/ 109 | 110 | LANGUAGE_CODE = 'en-us' 111 | 112 | TIME_ZONE = 'UTC' 113 | 114 | USE_I18N = True 115 | 116 | USE_L10N = True 117 | 118 | USE_TZ = True 119 | 120 | 121 | # Static files (CSS, JavaScript, Images) 122 | # https://docs.djangoproject.com/en/1.11/howto/static-files/ 123 | 124 | STATIC_URL = '/static/' 125 | -------------------------------------------------------------------------------- /src/cfehome/settings/local.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for cfehome project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.11.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.11/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'o!uew-zq*&u50p#09e9t_%xb+cr(8$ju_8y&c$@kdo%cf@4=6@' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_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 | 41 | 'rest_framework', 42 | 'pages', 43 | 'products' 44 | ] 45 | 46 | MIDDLEWARE = [ 47 | 'django.middleware.security.SecurityMiddleware', 48 | 'django.contrib.sessions.middleware.SessionMiddleware', 49 | 'django.middleware.common.CommonMiddleware', 50 | 'django.middleware.csrf.CsrfViewMiddleware', 51 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 52 | 'django.contrib.messages.middleware.MessageMiddleware', 53 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 54 | ] 55 | 56 | ROOT_URLCONF = 'cfehome.urls' 57 | 58 | TEMPLATES = [ 59 | { 60 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 61 | 'DIRS': [], 62 | 'APP_DIRS': True, 63 | 'OPTIONS': { 64 | 'context_processors': [ 65 | 'django.template.context_processors.debug', 66 | 'django.template.context_processors.request', 67 | 'django.contrib.auth.context_processors.auth', 68 | 'django.contrib.messages.context_processors.messages', 69 | ], 70 | }, 71 | }, 72 | ] 73 | 74 | WSGI_APPLICATION = 'cfehome.wsgi.application' 75 | 76 | 77 | # Database 78 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases 79 | 80 | DATABASES = { 81 | 'default': { 82 | 'ENGINE': 'django.db.backends.sqlite3', 83 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 84 | } 85 | } 86 | 87 | 88 | # Password validation 89 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 90 | 91 | AUTH_PASSWORD_VALIDATORS = [ 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 100 | }, 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 103 | }, 104 | ] 105 | 106 | 107 | # Internationalization 108 | # https://docs.djangoproject.com/en/1.11/topics/i18n/ 109 | 110 | LANGUAGE_CODE = 'en-us' 111 | 112 | TIME_ZONE = 'UTC' 113 | 114 | USE_I18N = True 115 | 116 | USE_L10N = True 117 | 118 | USE_TZ = True 119 | 120 | 121 | # Static files (CSS, JavaScript, Images) 122 | # https://docs.djangoproject.com/en/1.11/howto/static-files/ 123 | 124 | STATIC_URL = '/static/' 125 | -------------------------------------------------------------------------------- /src/cfehome/settings/production.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for cfehome project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.11.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.11/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'o!uew-zq*&u50p#09e9t_%xb+cr(8$ju_8y&c$@kdo%cf@4=6@' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_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 | 41 | 42 | 'rest_framework', 43 | 'pages', 44 | 'products' 45 | ] 46 | 47 | MIDDLEWARE = [ 48 | 'django.middleware.security.SecurityMiddleware', 49 | 'django.contrib.sessions.middleware.SessionMiddleware', 50 | 'django.middleware.common.CommonMiddleware', 51 | 'django.middleware.csrf.CsrfViewMiddleware', 52 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 53 | 'django.contrib.messages.middleware.MessageMiddleware', 54 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 55 | ] 56 | 57 | ROOT_URLCONF = 'cfehome.urls' 58 | 59 | TEMPLATES = [ 60 | { 61 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 62 | 'DIRS': [], 63 | 'APP_DIRS': True, 64 | 'OPTIONS': { 65 | 'context_processors': [ 66 | 'django.template.context_processors.debug', 67 | 'django.template.context_processors.request', 68 | 'django.contrib.auth.context_processors.auth', 69 | 'django.contrib.messages.context_processors.messages', 70 | ], 71 | }, 72 | }, 73 | ] 74 | 75 | WSGI_APPLICATION = 'cfehome.wsgi.application' 76 | 77 | 78 | # Database 79 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases 80 | 81 | DATABASES = { 82 | 'default': { 83 | 'ENGINE': 'django.db.backends.sqlite3', 84 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 85 | } 86 | } 87 | 88 | 89 | # Password validation 90 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 91 | 92 | AUTH_PASSWORD_VALIDATORS = [ 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 101 | }, 102 | { 103 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 104 | }, 105 | ] 106 | 107 | 108 | # Internationalization 109 | # https://docs.djangoproject.com/en/1.11/topics/i18n/ 110 | 111 | LANGUAGE_CODE = 'en-us' 112 | 113 | TIME_ZONE = 'UTC' 114 | 115 | USE_I18N = True 116 | 117 | USE_L10N = True 118 | 119 | USE_TZ = True 120 | 121 | 122 | # Static files (CSS, JavaScript, Images) 123 | # https://docs.djangoproject.com/en/1.11/howto/static-files/ 124 | 125 | STATIC_URL = '/static/' 126 | -------------------------------------------------------------------------------- /src/cfehome/urls.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Django 1.11 and below 4 | from django.conf.urls import include, url as re_path 5 | """ 6 | 7 | # Using Django 2.0 and up 8 | from django.urls import include, path, re_path 9 | from django.contrib import admin 10 | 11 | from pages.views import FrontendRenderView 12 | 13 | urlpatterns = [ 14 | re_path(r'^admin/', admin.site.urls), 15 | re_path(r'^api/products/', include("products.api.urls")), 16 | # re_path(r'^api/abc/', include("abc.api.urls")), 17 | # re_path(r'^api/cart/', include("cart.api.urls")), 18 | ] 19 | 20 | urlpatterns += [ 21 | # your integrate path 22 | re_path(r'(?P.*)', FrontendRenderView.as_view(), name='home') 23 | ] 24 | # django no longer handles 404/403/500 errors; frontend does -------------------------------------------------------------------------------- /src/cfehome/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for cfehome project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cfehome.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /src/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingforentrepreneurs/Django-JS-Frontend-Integration/ae5379766b2327738e0c23ff044ae550fd44cc2d/src/db.sqlite3 -------------------------------------------------------------------------------- /src/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cfehome.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) 23 | -------------------------------------------------------------------------------- /src/pages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingforentrepreneurs/Django-JS-Frontend-Integration/ae5379766b2327738e0c23ff044ae550fd44cc2d/src/pages/__init__.py -------------------------------------------------------------------------------- /src/pages/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /src/pages/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PagesConfig(AppConfig): 5 | name = 'pages' 6 | -------------------------------------------------------------------------------- /src/pages/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingforentrepreneurs/Django-JS-Frontend-Integration/ae5379766b2327738e0c23ff044ae550fd44cc2d/src/pages/migrations/__init__.py -------------------------------------------------------------------------------- /src/pages/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /src/pages/templates/pages/front-end-render.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% comment "Load your css like so" %} 10 | 11 | {% endcomment %} 12 | 13 | 14 | Hello, world! 15 | 16 | 17 |

Hello, world!

18 | 19 | 20 | 21 | 22 | {% comment "Below is an example of how you might render your Angular/React/Vue front-end framework code" %} 23 | 24 | {% endcomment %} 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/pages/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /src/pages/views.py: -------------------------------------------------------------------------------- 1 | from django.views.generic import View 2 | from django.shortcuts import render 3 | 4 | 5 | class FrontendRenderView(View): 6 | def get(self, request, *args, **kwargs): 7 | return render(request, "pages/front-end-render.html", {}) -------------------------------------------------------------------------------- /src/products/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingforentrepreneurs/Django-JS-Frontend-Integration/ae5379766b2327738e0c23ff044ae550fd44cc2d/src/products/__init__.py -------------------------------------------------------------------------------- /src/products/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Product 4 | 5 | admin.site.register(Product) -------------------------------------------------------------------------------- /src/products/api/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from products.models import Product 4 | 5 | class ProductSerializer(serializers.ModelSerializer): 6 | class Meta: 7 | model = Product 8 | fields = [ 9 | 'id', 10 | 'title', 11 | 'description', 12 | 'price' 13 | ] -------------------------------------------------------------------------------- /src/products/api/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import re_path 2 | 3 | from .views import ProductListAPIView, ProductRetrieveAPIView 4 | 5 | app_name = 'products-api' 6 | 7 | urlpatterns = [ 8 | re_path(r'^$', ProductListAPIView.as_view(), name='list'), 9 | re_path(r'^(?P\d+)/$', ProductRetrieveAPIView.as_view(), name='detail') 10 | 11 | ] -------------------------------------------------------------------------------- /src/products/api/views.py: -------------------------------------------------------------------------------- 1 | from rest_framework import generics 2 | from rest_framework.permissions import IsAuthenticatedOrReadOnly 3 | 4 | 5 | from products.models import Product 6 | 7 | 8 | from .serializers import ProductSerializer 9 | 10 | class ProductListAPIView(generics.ListAPIView): 11 | queryset = Product.objects.all() 12 | serializer_class = ProductSerializer 13 | permission_classes = [IsAuthenticatedOrReadOnly] 14 | 15 | 16 | class ProductRetrieveAPIView(generics.RetrieveAPIView): 17 | queryset = Product.objects.all() 18 | serializer_class = ProductSerializer 19 | permission_classes = [IsAuthenticatedOrReadOnly] 20 | lookup_field = 'id' -------------------------------------------------------------------------------- /src/products/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ProductsConfig(AppConfig): 5 | name = 'products' 6 | -------------------------------------------------------------------------------- /src/products/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.4 on 2018-04-04 21:21 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Product', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=120)), 19 | ('description', models.TextField()), 20 | ('price', models.DecimalField(decimal_places=2, default=9.99, max_digits=10)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /src/products/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingforentrepreneurs/Django-JS-Frontend-Integration/ae5379766b2327738e0c23ff044ae550fd44cc2d/src/products/migrations/__init__.py -------------------------------------------------------------------------------- /src/products/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.urls import reverse 3 | 4 | def upload_product_image(instance, filename): 5 | Klass = instance.__class__ 6 | id_ = Klass.objects.count() 7 | return f"products/{id_}/{filename}" # "products/{id_}/{filename}".format(id_=id_, filename=filename) 8 | 9 | 10 | class Product(models.Model): 11 | title = models.CharField(max_length=120) 12 | description = models.TextField() 13 | #image = models.ImageField(upload_to='products/', blank=True, null=True) 14 | price = models.DecimalField(max_digits=10, decimal_places=2, default=9.99) 15 | 16 | def __str__(self): 17 | return self.title 18 | 19 | def get_api_url(self): 20 | return reverse("products-api:detail", kwargs={"id": self.id}) 21 | -------------------------------------------------------------------------------- /src/products/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /src/products/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /src/requirements.txt: -------------------------------------------------------------------------------- 1 | dj-database-url==0.5.0 2 | Django==2.0.4 3 | django-crispy-forms==1.7.2 4 | djangorestframework==3.8.1 5 | gunicorn==19.7.1 6 | olefile==0.44 7 | Pillow==5.1.0 8 | psycopg2==2.7.3 9 | pytz==2017.2 10 | --------------------------------------------------------------------------------