How to make a website with Python and Django - MODELS AND MIGRATIONS (E04)

Поділитися
Вставка
  • Опубліковано 8 вер 2024

КОМЕНТАРІ • 67

  • @LinsLouis
    @LinsLouis 3 роки тому +8

    At 4:38 new import appeared "from django.http import HttpRequest, HttpResponse" and
    "def index(request):
    print(request.user)
    return render(request, 'index.html') " changed to
    "def index(request: HttpRequest) -> HttpResponse:
    return render(request, "index.html")"
    similarly, below in views.py. Why it is not explained?

  • @albythekkedan
    @albythekkedan 3 роки тому +10

    Why is it showing Improperly Configured cannot import accounts

    • @albythekkedan
      @albythekkedan 3 роки тому

      My AccountsConfig.name inside apps.py of accounts may not be correct ,and i can't find that part in this video,can anyone show

    • @albythekkedan
      @albythekkedan 3 роки тому

      So i am not able to migrate

    • @robertlink198
      @robertlink198 3 роки тому +15

      ​@@albythekkedan I got stuck there too, in accounts/apps.py the name needed to be the full module path identical to what was entered on line 41 of settings.py under installed apps

    • @mathmeup561
      @mathmeup561 3 роки тому +5

      changw in apps.py name="accounts" by name = 'Hacker_website.apps.accounts'

    • @maxpeterson9886
      @maxpeterson9886 3 роки тому +1

      @@robertlink198 Thank you.

  • @kiaehe6292
    @kiaehe6292 2 роки тому +6

    I hate the reorganizing part he is just moving too fast frustrating as hell

    • @hackershack
      @hackershack  2 роки тому +1

      Have to move fast to get through content in a reasonable time. Try slowing the video down to .75 speed

    • @CitizensCommunity
      @CitizensCommunity 2 роки тому +2

      Do this, k, now forget that and do this instead. I get that it is needed to explain the setup and the why, but it is also confusing and doing so really fast makes it worse. Who is this for, is it beginners or a refresher? You are doing a great job explaining things, so I guess we are just wanting to hear you talk even more.

    • @augustuscall3057
      @augustuscall3057 2 роки тому +3

      @@hackershack I have to agree here. The explanations themselves are generally excellent, but you *have* to start doing that with the reorganization on future projects if you haven't already. It's the equivalent of trying to learn a new level or area of mathematics and the professor is not showing their work or explaining what they're actually doing to an equation to simplify it. It added an unnecessary amount of frustration and confusion to what was otherwise a good walkthrough.

  • @johanstovring
    @johanstovring 3 роки тому +6

    hello I can't find the part about the setup.cfg, can you help me?

  • @swissshooter233
    @swissshooter233 3 роки тому +9

    Cannot migrate the project, as I'm getting the following error:
    Does anybody have an idea on how to fix?
    ModuleNotFoundError: No module named 'accounts'
    During handling of the above exception, another exception occurred:
    django.core.exceptions.ImproperlyConfigured: Cannot import 'accounts'. Check that 'hackershack_website.apps.accounts.apps.AccountsConfig.name' is correct.

    • @rudyjohari7338
      @rudyjohari7338 3 роки тому

      I have the same one too did you find a solution? I read up to change the app name to "apps.accounts" instead of "accounts" but it still didn't work :(

    • @ThEmIsErAbLeGaMeR
      @ThEmIsErAbLeGaMeR 2 роки тому

      did you end up fixing this?

    • @Bemam0406
      @Bemam0406 2 роки тому +2

      @@ThEmIsErAbLeGaMeR from Django 3.2 to later, In your apps: name = 'Project\folder\accounts'

    • @alddan098
      @alddan098 2 роки тому +8

      @@ThEmIsErAbLeGaMeR Had this same issue. Fixed it by changing the 'name' variable under the apps.py file to: name = 'projectName.folder.accounts'
      I tried the suggestion that thịnh đồng vĩnh made in another comment but it didn't work. Had to use periods rather than \ or /.
      So for the example in the video it would be: name = 'hackerhshack_website.apps.accounts'

  • @nadeemsaif6507
    @nadeemsaif6507 3 роки тому +7

    Hey man, I just wanted to say, these are some great vids.....
    I'm a little slow to understand so there is a littel part that I completely missed :)
    When you reorganized the routes, (public and accounts), in the navbar html we were supposed to do the same thing we did with the public app, where we changed the "url 'contact' " to "url 'public:contact' " I forgot to do that with the accounts app since i was following the tutorial frame by frame😅 i guess that was on me, so whenever I tried to login it kept redirecting me to the page i was already on, but i fixed it now......
    I'm a noob uni student 🙆‍♂️
    Anyways, great quality man keep it up, I've been binge watching your playlist for a week now....

    • @st3n007
      @st3n007 3 роки тому +1

      i have the same problem :/ what did you do then?

    • @nadeemsaif6507
      @nadeemsaif6507 3 роки тому +4

      @@st3n007 in "Settings.py" scroll to the end of the file and make sure that this line exists: (LOGIN_URL = "accounts:login")
      Then go to your "navbar.html" file and update this line from: {% url 'login' as login_url %}
      To: {% url 'accounts:login' as login_url %}
      And do the same thing with (url logout).....
      .
      .
      .
      Thats only if u have the same problem...

    • @st3n007
      @st3n007 3 роки тому +1

      @@nadeemsaif6507 omg thank you so so much, now it works!!, can i add you? :)

    • @albythekkedan
      @albythekkedan 3 роки тому +1

      @@nadeemsaif6507 Worked mahn Thank You, I was having same issue

    • @albythekkedan
      @albythekkedan 3 роки тому

      also i forgot to give accounts:profile as profile_url ,now i corrected it

  • @Kwatch
    @Kwatch 3 роки тому +1

    your explanation is very detailed well done

  • @user-kn4js8ef1f
    @user-kn4js8ef1f 2 роки тому +1

    At 31:39, can I know where to create the "user" from the request.user.profile.interest. I cant define the 'user' attribute

  • @zavio3199
    @zavio3199 3 роки тому

    very inforative and helpfl video, thankyou very much

  • @murrays1347
    @murrays1347 Рік тому

    Thank you for this hands-on tutorial. I've been following along as much as I can and have a couple of questions. Can this application be scaled up to accept files of various formats from users over the web? I'm considering developing an app to track missing people (outside US) and would need to capture information about victims including audio/video, and create links between victims where applicable. Also, what is the purpose of the requirements folder? So far I haven't seen it being used.

  • @darbyblum8027
    @darbyblum8027 5 місяців тому

    After reorganizing at the beginning, I can no longer reach my profile page unless I manually type /accounts/profile in the URL. Any tips?

  • @Calmulification
    @Calmulification 2 роки тому

    very great tutorial thanks

  • @ilyazlatkin4594
    @ilyazlatkin4594 Рік тому

    Thank you for the tutorial.
    I have a question.
    I want to create an app that has a text field and button. When you hit a button, it runs a third-party-long script (let's say ML). When the script is running, the app should display the "processing-loading," and when it is ready, it should return the script's HTML.
    Does anyone know any project I can reference or and template?

  • @lyricsmint567
    @lyricsmint567 4 роки тому

    I had my login implementation straight from documentation, now on I will follow your tutorials

  • @FARAHEED
    @FARAHEED 3 роки тому +3

    at the end of the video in the "with" sign make sure to not add space between profile and the equal sign
    so it should look like smth like this {% with profile=user.profile %}
    and this {% with website=profile.website|default:"" %}

  • @KevinTempelx
    @KevinTempelx 3 роки тому

    Thank you!

  • @dominiq2345
    @dominiq2345 3 роки тому

    When I did makemigrations, it says no changes detected even tho I added path in INSTALLED_APPS in settings, help pls

  • @miladata6383
    @miladata6383 2 роки тому

    Hi, I am following your videos step by step, they are really good. However, I have a bug and I can't solve it yet. It is this:
    Exception Type: NoReverseMatch
    Exception Value:
    Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
    I put the line error here:
    Ingresar{% endif %}
    Can you help me, please

    • @EndlesRidge
      @EndlesRidge 2 роки тому

      bruh, literally just do the same thing to everything he did to public:stuff but instead with accounts

    • @yukaihuang1622
      @yukaihuang1622 2 роки тому +2

      I have got the same error, but mine was 'Reverse for 'logout' not found.' Did you find the solution? Thank you!
      dang~ I fixed it. I guess it was on me. Forgot to put

    • @miladata6383
      @miladata6383 2 роки тому

      @@yukaihuang1622 Yes, i'm not doing the project now but it was all chaos when change the database to postgres :( i had problems with some packages as psycopg2

  • @jonasholmgaard5464
    @jonasholmgaard5464 3 роки тому

    black . is not a command when i type into my terminal :((

    • @mathmeup561
      @mathmeup561 3 роки тому +1

      use black file_name.py or black folder_name/

    • @jonasholmgaard5464
      @jonasholmgaard5464 3 роки тому

      @@mathmeup561 thank you!! i realized i actually needed to install black, i didn't know that was something you had to do

    • @mathmeup561
      @mathmeup561 3 роки тому

      @@jonasholmgaard5464 Yes!! sometimes a lot of details are missing in the videos but overall its good video series for a advanced programer

    • @dickiefinehuman5269
      @dickiefinehuman5269 2 роки тому

      yeah you have to brew install it.