tag: python3

  • How to upgrade all the packages in your Django application in one fell swoop

    How to upgrade all the packages in your Django application in one fell swoop

    Maria D. Campbell

    How to upgrade all the packages in your Django application in one fell swoop.

    #fullstack development, #macOS, #django, #python3, #pip, #dependency conflicts, #package upgrade

  • AbstractUser vs AbstractBaseUser vs User extended profile in Django Part 2

    AbstractUser vs AbstractBaseUser vs User extended profile in Django Part 2

    Maria D. Campbell

    A step-by-step walkthrough of building a custom Django user model using AbstractUser, including a custom manager, tests-first setup, migrations, and admin configuration.

    #fullstack development, #macOS, #django, #python3, #abstractuser, #admin, #forms, #model manager, #tests, #unittest, #user model, #schema, #series, #superuser

  • AbstractUser vs AbstractBaseUser vs User extended profile in Django Table of Contents

    AbstractUser vs AbstractBaseUser vs User extended profile in Django Table of Contents

    Maria D. Campbell

    A table of contents for my series on Django's AbstractUser, AbstractBaseUser, and extended User profile approaches — covering custom user models, migrations, forms, admin configuration, and testing.

    #fullstack development, #macOS, #django, #python3, #abstractuser, #abstractbaseuser, #admin, #forms, #model manager, #tests, #unittest, #user model, #schema, #series, #superuser

  • AbstractUser vs AbstractBaseUser vs User extended profile in Django Part 1

    AbstractUser vs AbstractBaseUser vs User extended profile in Django Part 1

    Maria D. Campbell

    A test-driven walkthrough of building a custom user model with AbstractBaseUser in Django, including the model manager, migrations, forms, and admin configuration.

    #fullstack development, #macOS, #django, #python3, #abstractbaseuser, #admin, #forms, #model manager, #tests, #unittest, #user model, #schema, #series, #superuser

  • How to reuse an app created in one Django project in another Django project

    How to reuse an app created in one Django project in another Django project

    Maria D. Campbell

    In this post, I discuss how to reuse an app created in one Django project in another, so I don't have to re-create it from scratch.

    #fullstack development, #macOS, #django, #python3, #reusable app, #local development

  • Adding pre-commit hooks to a Django project

    Adding pre-commit hooks to a Django project

    Maria D. Campbell

    Learn how to add and configure the pre-commit framework in a Django project, including Black, isort, Flake8, and djLint, to automate code quality on every commit.

    #fullstack development, #macOS, #django, #python3, #code formatting, #djlint, #flake8, #isort, #linting, #pre-commit hook

  • How to upgrade the Python version in a virtual environment

    How to upgrade the Python version in a virtual environment

    Maria D. Campbell

    In this post, I show how to upgrade the Python version being used in a Django application's virtual environment.

    #fullstack development, #macOS, #django, #pip, #python3, #dependencies, #django commons, #django debug toolbar, #third party packages, #venv, #virtual environment

  • Creating the official Django Polls app Part 8

    Creating the official Django Polls app Part 8

    Maria D. Campbell

    In this section, we install the Django Debug Toolbar, configure the toolbar so it appears in the browser when we run our development server, learn that we can customize the toolbar, run our Django Polls project in the browser to view the toolbar, are introduced to resources where we can access other third party packages to use in our applications, and are provided with next steps.

    #fullstack development, #macOS, #django, #python3, #django commons, #django debug toolbar, #django settings, #pip, #series, #third party packages, #tutorial

  • Creating the official Django Polls app Part 7

    Creating the official Django Polls app Part 7

    Maria D. Campbell

    In this section, we customize the Question admin form, add Choice related objects to the admin form, customize the admin change list, add search capability to the admin interface, customize the admin look and feel, and customize our project's templates.

    #fullstack development, #macOS, #django, #python3, #admin change list customization, #admin form, #admin interface, #admin interface search capability, #series, #template customization, #tutorial

  • Creating the official Django Polls app Part 6

    Creating the official Django Polls app Part 6

    Maria D. Campbell

    In this section, we add static files to our Django Polls application configured for local development.

    #fullstack development, #macOS, #django, #python3, #local development, #series, #staticfiles, #static template tag, #tutorial

  • Creating the official Django Polls app Part 3

    Creating the official Django Polls app Part 3

    Maria D. campbell

    In this section, we write our first Django app, discuss URL patterns, write more views in polls/views.py, write views that actually work, re-write the index view, create a templates directory in the polls directory, implement template namespacing, add Django code to index.html, update the index view to use the new index.html template, implement the render() shortcut, implement raising a 404 error in the detail view, use get_object_or_404() in the detail view, discuss Model's manager in Django, discuss Manager names, use template tags in the template engining system, remove the hardcoded URL in the template in polls/index.html, and namespace our URL names.

    #fullstack development, #macOS, #django, #python3, #404, #model manager, #render shortcut, #series, #templates, #template namespacing, #tutorial, #urlpatterns, #views

  • How to create a fullstack application using Django and Python Part 33

    How to create a fullstack application using Django and Python Part 33

    Maria D. Campbell

    In this section, I get a custom domain for my Django Boards application from Namecheap, connect the custom domain to Render, configure domain verification with Namecheap for Mailtrap backend email service, add a new app called faqs, create the models for faqs, create a view for faqs, create a URLconf for the faqs_index view, configure the global URL configuration for faqs_index view in django_boards/urls.py, migrate faqs, and make the faqs app modifiable in the admin interface.

    #fullstack development, #macOS, #django, #app, #python3, #custom domain, #domain verification, #backend email service, #makemigrations, #migrate, #mailtrap, #namecheap, #series, #views

  • How to create a fullstack application using Django and Python Part 32

    How to create a fullstack application using Django and Python Part 32

    Maria D. Campbell

    In this section, I prepare my django-boards application for deployment to Render.

    #code refactoring, #debugging, #deployment, #django, #environ, #fullstack development, #local environment, #macOS, #persistent disk, #production environment, #python-decouple, #python-dotenv, #python3, #python shell, #render, #scp, #series, #settings directory, #ssh, #transferring files

  • How to create a fullstack application using Django and Python Part 31

    How to create a fullstack application using Django and Python Part 31

    Maria D. Campbell

    In this section, I modify settings in django_boards/settings.py for deployment on Heroku. I create a new SECRET_KEY for use on Heroku, add gunicorn, dj-database-url, psycopg2 and psycopg2-binary packages, create a requirements.txt file, create a Procfile, create a .python-version file, discuss the purpose of the os module, set DEBUG to false on Heroku, differentiate between DEBUG value in local development and production on Heroku, configure database access, run the collectstatic command for serving static files in production, and install and configure whitenoise.

    #fullstack development, #macOS, #heroku, #deployment, #django, #python3, #database access, #database configuration, #development, #gunicorn, #heroku postgres, #procfile, #production, #static files, #whitenoise, #series

  • How to create a fullstack application using Django and Python Part 30

    How to create a fullstack application using Django and Python Part 30

    Maria D. Campbell

    In this section, I place the default Django authentication system related templates into a new directory called registration inside the templates directory, I move the associated URLs into accounts/urls.oy, and add the associated default url pattern to django_boards/urls.py. This helps ensure that django-boards deployment to Heroku would be successful.

    #fullstack development, #macOS, #default django authentication system, #django, #python3, #series

  • How to create a fullstack application using Django and Python Part 29

    How to create a fullstack application using Django and Python Part 29

    Maria D. Campbell

    In this section, I create tests for the like_post view.

    #fullstack development, #macOS, #django, #python3, #like post, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 28

    How to create a fullstack application using Django and Python Part 28

    Maria D. Campbell

    In this section, I add a like button to the post_detail.html template. I add a likes field to my Post model, create a function based like_post view in boards/views.py, create JavaScript using the fetch() method for the Like button functionality on the client side, implement history.go(0) in the JavaScript to reload the page after the Like button is clicked to update the number of likes, create a like URL in boards/urls.py, and add post.likes to templates/post_detail.html.

    #fullstack development, #macOS, #django, #python3, #fetch api, #manytomany, #function based views, #jsonresponse, #history.go(0)

  • How to create a fullstack application using Django and Python Part 27

    How to create a fullstack application using Django and Python Part 27

    Maria D. Campbell

    In this section, I make some adjustments to existing functionalities, sanitize our Markdown, add code formatting and highlighting to our Markdown, create tests for the ProfileListView, protected function based profile view, and profile_detail view, update accounts/tests/test_form_signup_test.py, fix the topic posts avatar issue, and explain the extended profile functionality.

    #fullstack development, #macOS, #django, #python3, #code refactoring, #markdown, #nh3, #sanitization, #fenced code, #code highlighting, #pygments, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 26

    How to create a fullstack application using Django and Python Part 26

    Maria D. Campbell

    In this section, I extend the built-in Django User with a Profile model containing extra fields, create the Profile model in accounts/models.py, extend the User model using a one-to-one relationship with the built-in User, add a profile url to accounts.urls.py, moved the account url in boards/urls.py to accounts/urls.py, install the pillow package to enable use of the ImageField in the Profile model, configure urls.py for user-uploaded media files during development, implement signals.py in the accounts app, create an update profile form, create a profile.html template, delete existing users pre User profile and create new ones, and make styling adjustments to various templates.

    #fullstack development, #macOS, #django, #extended built-in user, #imagefield, #one-to-one relationship, #pillow, #python3, #series

  • How to create a fullstack application using Django and Python Part 25

    How to create a fullstack application using Django and Python Part 25

    Maria D. Campbell

    In this section, I add the Humanize package to our templates/topics.html, add the Gravatar package for user gravatars, and add the django-avatar package for automatic implementation of a user avatar when one is absent.

    #fullstack development, #macOS, #django, #django-avatar, #gravatar, #humanize, #python3, #series

  • How to create a fullstack application using Django and Python Part 23

    How to create a fullstack application using Django and Python Part 23

    Maria D. Campbell

    In this section, I create a generic class based view called UserUpdateView (My Account view), associated tests, a URL, and template.

    #fullstack development, #macOS, #django, #generic class based views, #python3, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 21

    How to create a fullstack application using Django and Python Part 21

    Maria D. Campbell

    In this section, I create a generic class-based (GCBV) PostUpdateView, PostDeleteView, and PostDetailView, create the associated urls and templates, create PostUpdateView, PostDeleteView, and PostDetailView tests, debug the code and tests, and check the test coverage of the django_boards project code.

    #fullstack development, #macOS, #coverage, #context, #dispatch, #django, #python3, #generic class based views, #method decorators, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 22

    How to create a fullstack application using Django and Python Part 22

    Maria D. Campbell

    In this section, I implement a Generic Class Based view and pagination to the index/home view, add pagination to the topics view and topic_posts view, add pagination to the associated templates, refactor the associated urls in urls.py, and refactor the associated tests. I also add a copy link button to copy the link to a topic's replies, a scroll top and scroll bottom button using JavaScript to enable their functionality, and add JavaScript code to make the scrollbar return to the bottom of the page when a pagination item is clicked.

    #fullstack development, #macOS, #django, #bootstrap pagination, #code refactoring, #clipboard api, #generic class based views, #python3, #scroll behavior, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 20

    How to create a fullstack application using Django and Python Part 20

    Maria D. Campbell

    In this section, I re-organize the accounts and boards tests content, refactor password reset-related django_boards/urls.py, fix the password reset-related accounts tests failures, add the password_change URL to templates/base.html, fix the 302 redirect-related failure in the boards.tests.test_view_reply_topic_tests, and add the reply_topic URL to templates/topic_posts.html.

    #fullstack development, #macOS, #django, #django 5.1, #python3, #authentication, #code refactoring, #code restructure, #debug code, #default password reset, #fix urls, #fix redirects, #resolve, #reverse, #security, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 19

    How to create a fullstack application using Django and Python Part 19

    Maria D. Campbell

    In this section, I implement protecting views, I configure the Login next redirect, I create @login_required tests, I update the topic posts view, create the topic_posts.html template and related tests, update the reply post (reply_topic) view and create related tests, discuss QuerySets and use them to improve the index/home view, improve the topics view, update the board_topics view, update the topics.html template, and add a new field to the Topic model.

    #fullstack development, #macOS, #django, #annotate, #next, #protecting views, #python3, #queryset, #series, #tests, #unittest

  • How to measure test coverage in Django

    How to measure test coverage in Django

    Maria D. Campbell

    Coverage.py is the go-to tool for measuring how much of your Django application your tests actually exercise. Here's how to install it, run it against a real project, and interpret the results.

    #command line, #terminal, #fullstack development, #macOS, #django, #python3, #tests, #coverage, #coverage.py

  • How to create a fullstack application using Django and Python Part 18

    How to create a fullstack application using Django and Python Part 18

    Maria D. Campbell

    In this section, I create the password_reset routes, views, tests, and templates. The results of the password reset process are output to the Terminal console. I debug the password_reset_confirm_tests tests to find out what the actual csrf token is and hard code it into the test_csrf (function) test. I re-use the Beautiful Soup 4 and Soup Sieve packages to refactor the test_form_inputs (function) test.

    #fullstack development, #django, #macOS, #python3, #password reset, #security, #series, #beautifulsoup4, #html5lib, #html parser, #soupsieve, #coverage.py, #test coverage, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 17

    How to create a fullstack application using Django and Python Part 17

    Maria D. Campbell

    In this section, I improve signup.html template design, add a logout view and route, create a dropdown menu for logged in users, create a login.html template, url, and redirect, create a reusable template, add non-field errors to login.html, create custom template tags to use in form.html, and test the template tags.

    #fullstack development, #macOS, #django, #bootstrap 5, #custom template tags, #python3, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 16

    How to create a fullstack application using Django and Python Part 16

    Maria D. Campbell

    In this section, I demonstrate an alternative to the original test_form_inputs test in which we used the .assertContains() method to verify the existence of specific inputs residing in the signup form. I install Beautiful Soup 4 and Soup Sieve along with the html5lib HTML parser, and then re-create the test_form_inputs test using those packages. The test is much shorter, and my approach to discovering the ids of the inputs I want to grab by inspecting the signup form element in the browser is quicker and much easier to read!

    #fullstack development, #macOS, #django, #beautifulsoup4, #soupsieve, #html5lib, #html parser, #python3, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 15

    How to create a fullstack application using Django and Python Part 15

    Maria D. Campbell

    In this section, we create an accounts app where everything related to user accounts resides.

    #fullstack development, #macOS, #user authentication, #django, #python3, #tests, #code modularization, #series, #unittest

  • How to create a fullstack application using Django and Python Part 14

    How to create a fullstack application using Django and Python Part 14

    Maria D. Campbell

    In this section, I build a NewTopicForm.

    #fullstack development, #macOS, #django, #django forms api, #bootstrap, #csrf token, #django-widget-tweaks, #python3, #response context attribute, #security, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 13

    How to create a fullstack application using Django and Python Part 13

    Maria D. Campbell

    In this section, I create a reusable, base template called base.html, integrate it into index.html, integrate it into topics.html, test django_boards after making those changes, add a navigation menu to base.html, create an app.css file in the static/css directory, change the logo font with a Google font which I import into app.css, and tweak the logo styling with CSS.

    #fullstack development, #css, #django, #macOS, #python3, #reusable templates, #series, #template extending, #template tags

  • How to create a fullstack application using Django and Python Part 12

    How to create a fullstack application using Django and Python Part 12

    Maria D. Campbell

    In this section, I add the IndexTests class to boards/tests.py, update templates/index.html to make a failed test pass, write a test for linking back to the index/home page from the single Board page, update templates/topics.html to link back to the index/home page, and update templates/topics.html so a failed test will pass.

    #fullstack development, #macOS, #django, #dynamic urls, #python3, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 11

    How to create a fullstack application using Django and Python Part 11

    Maria D. Campbell

    In this section, I update the class models in boards/models.py to include PostLike, migrate the updated models, add the dynamic path for a single board in django_boards/urls.py, create the board_topics view inside boards/views.py, create the topics.html template inside the templates directory, and create/run tests for BoardTopics.

    #fullstack development, #macOS, #django, #django shortcuts, #dynamic urls, #python3, #series, #tests, #unittest

  • How to create a fullstack application using Django and Python Part 10

    How to create a fullstack application using Django and Python Part 10

    Maria D. Campbell

    In this section, I update the UML Class Diagrams and wireframe(s) to include the PostLike Model, and I clarify the concepts of "topic" and "post".

    #macOS, #django, #fullstack development, #python3, #series, #uml class diagram, #uml, #wireframe

  • How to create a fullstack application using Django and Python Part 9

    How to create a fullstack application using Django and Python Part 9

    Maria D. Campbell

    In this section, I introduce the Django Admin, configure the Django Admin by creating a superuser, register the boards app in boards/admin.py, add a board in the Django Admin interface, and delete a board in the Django Admin interface.

    #macOS, #django, #fullstack development, #python3, #django admin, #superuser, #register app, #series

  • How to create a fullstack application using Django and Python Part 8

    How to create a fullstack application using Django and Python Part 8

    Maria D. Campbell

    In this section, I add an index.html template to a directory called static, test the index (home) page, set up the static files, download Bootstrap, configure the static directory in settings.py, discuss the collectstatic command, load the Bootstrap CSS file in index.html, and edit index.html to include Bootstrap styling.

    #macOS, #django, #fullstack development, #python3, #python3 shell, #bootstrap, #static, #collectstatic, #series, #tests

  • How to create a fullstack application using Django and Python Table of Contents

    How to create a fullstack application using Django and Python Table of Contents

    Maria D. Campbell

    How to create a fullstack application using Django and Python Table of Contents. This is where I will be adding upcoming sections of the series as well as adding this table of contents as a related post to each part of the series.

    #macOS, #django, #fullstack development, #python3, #table of contents, #series

  • How to create a fullstack application using Django and Python Part 7

    How to create a fullstack application using Django and Python Part 7

    Maria D. Campbell

    In this section, I discuss the Django model basics, I compare the UML Class Fields Diagram to the models.py source code, I migrate the models with the makemigrations command, apply the model migrations with the migrate command, play with the Models API, and discuss the Django Model manager.

    #macOS, #django, #fullstack development, #makemigrations, #migrate, #model operations, #model manager, #python3, #python shell, #queryset, #series

  • How to create a fullstack application using Django and Python Part 5

    How to create a fullstack application using Django and Python Part 5

    Maria D. Campbell

    In this section, I discuss and show how one can change a project name after it has already been created and migrated. It's really not as difficult as it sounds!

    #macOS, #django, #env, #fullstack development, #grep, #pipe, #python3, #series, #virtualenv, #vscode

  • How to create a fullstack application using Django and Python Part 4

    How to create a fullstack application using Django and Python Part 4

    Maria D. Campbell

    In this section, I discuss how to install the python-dotenv package and why it is crucial to do so as to safeguard sensitive information the Django application depends on.

    #macOS, #environment variables, #.env, #fullstack development, #git, #gitignore, #python3, #django, #python-dotenv, #security, #series

  • How to create a fullstack application using Django and Python Part 3

    How to create a fullstack application using Django and Python Part 3

    Maria D. Campbell

    In this section, I compare Django projects vs apps, create my first app in the Django project, configure the boards app in the django_boards project, write the first boards app view, tell the Django project when to serve the view, break down the code in urls.py, and run the development server to view the results of the changes made to views.py and urls.py.

    #macOS, #fullstack development, #django, #admin site, #migrations, #models, #views, #python3, #django project, #django app, #urlpatterns, #series

  • How to create a fullstack application using Django and Python Part 2

    How to create a fullstack application using Django and Python Part 2

    Maria D. Campbell

    In this section, I create a Django project inside the Django Boards application, break down the project structure and describe what each component means and does, and after creating the Django project, I start up the development server.

    #macOS, #django, #fullstack development, #python3, #django project, #runserver, #series

  • How to create a fullstack application using Django and Python Part 1

    How to create a fullstack application using Django and Python Part 1

    Maria D. Campbell

    In this section, I create the project directory, install pyenv with Homebrew, install Python 3.12.5 with pyenv, execute the pyenv local command, install virtualenv and create a virtual environment, activate and deactivate the environment, and install Django.

    #django, #fullstack development, #grep, #pipe, #homebrew, #macOS, #pyenv, #pyenv local, #python3, #virtualenv, #series

  • Creating a basic Python web server in Linux

    Creating a basic Python web server in Linux

    Maria D. Campbell

    How to create a basic Python web server in Linux.

    #linux, #python3, #http server, #web server

  • Encrypting and Decrypting Files and Strings

    Encrypting and Decrypting Files and Strings

    Maria D. Campbell

    How to encrypt and decrypt files and strings with Python vs Command Line.

    #decryption, #encryption, #symmetric encryption, #command line, #macOS, #python3, #security