Django ChatGPT Clone Tutorial

Поділитися
Вставка
  • Опубліковано 6 лют 2025

КОМЕНТАРІ • 114

  • @xxoooOFxx
    @xxoooOFxx Рік тому +16

    Well done, and an excellent intro to Django. Happy to see more of my African brothers doing programming! AI and software is the future, and Africa is the next frontier.

  • @williamlennon2070
    @williamlennon2070 Рік тому +9

    Nicely done! Thank you for explaining things the way you do. I like how you run the code with it not working first, then explain why it wasn't working. Gives the video a great pace and helps debug our own issues.

  • @lemonjuice6177
    @lemonjuice6177 10 місяців тому

    thats the best front end professor ive ever seen, OH MY GOD I LOVE YOU

  • @CodeWithTomi
    @CodeWithTomi Рік тому +10

    Thank you freecodecamp for publishing this tutorial. I hope it’s helpful

  • @ChrisEj_The_Broly
    @ChrisEj_The_Broly Рік тому +9

    This young brother wants me to not give up on django, well done bro👏👏👏

  • @jennifermckeithen1498
    @jennifermckeithen1498 Рік тому +5

    This is great!! I really appreciate the detail and explanations! You have the heart of a teacher, mon ami !

  • @CheckMateBoyz
    @CheckMateBoyz Рік тому +1

    I can not thank you enough :) I am new in Django and your video realy helped me ... Thank you so much :)

  • @sandeepnayak6357
    @sandeepnayak6357 Рік тому +3

    crazy tutorial man loved it! well explained

  • @pinkflower03
    @pinkflower03 Рік тому +16

    Oh Oh, going for next level now.

  • @Chisanloius
    @Chisanloius Рік тому +2

    this chap is so good, thanks so much man

  • @liliyalopez8998
    @liliyalopez8998 Рік тому +1

    Very well explained! Great job!

  • @MrDekassia
    @MrDekassia Рік тому +1

    Thanks Tomi! Amazing tutorial😊

  • @vbncml
    @vbncml 8 місяців тому

    Thanks for the tutorial! I've learned a lot and even more

  • @AliceQian-s2m
    @AliceQian-s2m 11 місяців тому

    Nice work!keep going🎉🎉 3:33

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

    Great job, Tomi!

  • @julionicolinopavettiavila5342
    @julionicolinopavettiavila5342 Рік тому +8

    Your work is impressive my friend.
    One question... How can I change the language of the AI, for example in Spanish?

    • @21cyco33
      @21cyco33 Рік тому

      there must be a api for that?

  • @GAMINGASTER
    @GAMINGASTER Рік тому +7

    Thank you guys for helped me a lot ❤

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

    The tutorial is understandable !

  • @AaronTheImposter
    @AaronTheImposter Рік тому +55

    Why y'all put "Django" so large next to this man? Y'all tryna say he's unchained?!?

  • @infoboxind1874
    @infoboxind1874 Рік тому +10

    Great work!!!!🎉🎉 Love your content

  • @usmanadesola5144
    @usmanadesola5144 Рік тому +3

    Thanks for the tutorial Boss Tomi.

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

    Thank you very muss, that was very good

  • @mohdalim77
    @mohdalim77 10 місяців тому

    Bukayo saka doing side quests 😂

  • @NonnoSgrenf
    @NonnoSgrenf Рік тому +1

    Niceeeee video!!!

  • @kazethenoob8591
    @kazethenoob8591 10 місяців тому +2

    Doesn’t work again for me now I get an error saying the OpenAI is not supported again bla bla and I am using gpt 4 api

  • @HuzaifaSaran
    @HuzaifaSaran 4 місяці тому

    Thanks MAN. Everything worked perfectly just my chatgpt quota is finished without even showing any reply. but if i get paid version and connect with this. hope so it will reply me . again Thanku.

  • @EricMwangi-r1d
    @EricMwangi-r1d 11 місяців тому

    Thanks bro.

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

    Thanks free code camp

  • @jishnusaurav
    @jishnusaurav 10 місяців тому

    Can you also share to add a voice button ?

  • @SamGralla
    @SamGralla Рік тому +2

    Is there a relatively simple way to receive data back as a stream and forward to the client? I know django isn't built for this... but I'm stuck with it for my project. Thanks for the video.

    • @xushnudbekjumayev
      @xushnudbekjumayev Рік тому +1

      i am stucked on this turorial with this isuee pls help me if you know
      raise self.handle_error_response(
      openai.error.InvalidRequestError: The model: `gpt-4` does not exist
      [01/Jun/2023 14:03:12] "POST / HTTP/1.1" 500 91452

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

      You want django-channels for that

  • @momojafar9385
    @momojafar9385 4 місяці тому

    can you do one with llama instead?

  • @Duke-of-Minecraft
    @Duke-of-Minecraft 8 місяців тому

    can we add our own ui and if yes then how to do it and wher to do it

  • @amarnath.c7861
    @amarnath.c7861 Рік тому +1

    this one couldn't respond me? what can i do?? if i put input , it couldnt respnd me..tell me a solution

  • @user-gq1ij
    @user-gq1ij Рік тому +1

    I don't understand the need of gpt-4 integration
    Can someone explain

  • @AzimQurbonov-j1n
    @AzimQurbonov-j1n Рік тому +1

    where can i get js code ?

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

    Tomi, can you please make a tutorial on how we can convert our Django projects into .exe or .apk and iOS. This will come helpful, thanks bro, thumbs up

    • @TechDesignHub
      @TechDesignHub Рік тому +1

      Django is for back end .. you can use other framework for front end and you can serve that into exe or APK which will still connect to a server ( backend )

  • @briansalvator31
    @briansalvator31 Рік тому +3

    guess this project is restricted to those who have paid access to the openAI huh

  • @muhammadubaid6576
    @muhammadubaid6576 Рік тому +1

    Sir make tutorials on document tracking system web based in MERN Stack with source code

  • @EdgeHorizonAmon
    @EdgeHorizonAmon Рік тому +1

    If you remove the message-list class from chatbot.html the chats do not render. Can someone explain how that works

  • @pritampatil7521
    @pritampatil7521 7 місяців тому

    The OpenAI api key that generates its free of cost

  • @VishwajitRajput-i2q
    @VishwajitRajput-i2q Рік тому +1

    i can not get answers by api key why, please help me??

    • @rupesh5365
      @rupesh5365 7 місяців тому

      Same bro may be model id not working

  • @JamesLove2
    @JamesLove2 Рік тому +1

    When I went to refresh the page, it says template does not exist at chatbot.html, but I copied the provided code and saved my file as chatbot.html. What could be wrong?

  • @jayy4081
    @jayy4081 Рік тому +2

    Hi do i need a paid openai account?

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

      yes and to pay
      18$ for paid account

    • @ZhiyanAbdallah
      @ZhiyanAbdallah Місяць тому

      Yhs do we need to pay?
      I think so 😢

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

    How you open the finder plzz help me

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

    My aiohttp is not downloading 😢

  • @ENDTIM3SPRODUCTIONS
    @ENDTIM3SPRODUCTIONS Рік тому +4

    could had added a link to the original video to get the templates!

    • @moneymemes
      @moneymemes Рік тому +1

      YEAH , WITHOUT THAT THE PROJECT IS MEANINGLESS; I HAVE SEARCHED IT EVERYWHERE

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

    i am getting error : Uncaught SyntaxError: Unexpected token '

  • @biragacharya9745
    @biragacharya9745 4 місяці тому

    is it still working?

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

    Thank's

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

    Yo where are the html files?

  • @avantikashaileshraodeshmukh
    @avantikashaileshraodeshmukh 9 місяців тому

    thanksss buddy

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

    Missed to add GitHub url

  • @cloverbeats7990
    @cloverbeats7990 Рік тому +2

    i keep getting a "Uncaught (in promise) SyntaxError: Unexpected token '

  • @dhananjayadk4611
    @dhananjayadk4611 Рік тому +1

    ❤❤❤ first

  • @그대여달99
    @그대여달99 Рік тому

    43:00

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

    18:31

  • @oyesaurabh
    @oyesaurabh Рік тому +2

    is this api paid ?

  • @Tman234h
    @Tman234h Рік тому +2

    wow how old is this kid??

    • @quincylarsonmusic
      @quincylarsonmusic Рік тому +1

      He's 18. One of the brightest, most ambitious devs I know.

  • @Ceejayokoye
    @Ceejayokoye Рік тому +3

    This accent looks Nigerian

  • @germanpinto883
    @germanpinto883 Рік тому +2

    WOW he's a child 🤯

    • @moomoo-bv3ig
      @moomoo-bv3ig Рік тому +1

      I learned frames in HTML before I was 17, and had a free page that hosted my website with frames, complete with message boards on every page and it lasted almost ten years. That is the best time to learn and teach code.

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

    Hey! I am first.

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

    This project is filled with bad practices. Be warned.

    • @vishnuhunnithan3086
      @vishnuhunnithan3086 10 місяців тому

      Like? Just making remarks without qualifying it with observations is neither useful nor does it make you sound like someone who is serious about learning.

    • @Famelhaut
      @Famelhaut 10 місяців тому

      @vishnuhunnithan3086
      You're right, I should have elaborated.
      The project doesn't have a gitignore, requirements txt or a pyproject toml file. It wasn't made with dependency or package management in mind, or from a project template. This is why the sqlite3 database and pycache files were committed to the project.
      The production secrets are hardcoded in the code instead of being imported from enviroment variables with something like python-dotenv or better yet, from the system itself.
      There are only development settings. In a real application you would either have another settings file for production or another branch with all the production settings.
      The templates aren't namespaced to the app. The Django tutorial explains very well why this is important.
      The chat model uses the User model directly. You should never do this, and instead create a new User model from the AbstractUser class. The Djando docs explain why aswell.
      The templates define the style directly. This should be in a specialized css file that is imported in the base html.
      The base html template uses cdns, you shouldn't use cdns in production unless you're the owner of them. It also imports bootstrap, so I wonder why even have custom styles in the templates.
      The register and login templates can probably be simplified, but it's not a big problem.
      The chat template uses vanilla js when jquery was imported in the base. The code should either be using jquery or base html shouldn't use the jquery cdn.
      The chat template uses vanilla js in a script tag, it should be in another file specialized js file.
      The js code is fine, altough I would have personally used htmx instead of json.
      Now, the biggest problems are in views py:
      This project should have used websockets with django-channels instead of doing rest-like ajax requests. Chat applications need to be responsive to requests and don't follow the REST pattern very well, this is why if you use any chat application like discord, whatsapp, telegram, etc and switch to the network tab, you'll see that they use websockets. For a simple demonstration project it's fine, but it should have been done with websockets. The django-channels tutorial teaches you how to make a chat application.
      Leaving that aside, there are other problems in views py:
      ask_openapi shouldn't be in views py. It's not a view, it should be in utils py or services py or anywhere else.
      The project only uses functional views. These don't scale, and will only bring problems down the road if you don't refactor them into class-based-views. The project should have overriden one of the generic views from django with the additional needed functionality or written one from scratch by inheriting from View.
      login and register shouldn't exist. Django comes with pre-defined, customizable class-based-views for login, logout and changing password. registering can be done using the default UserCreationForm and a CreateView. The only thing that isn't done for you are the templates.
      The project shouldn't have a a view returning Json data, this should be handled with a serializer, with either django-rest or django-ninja. The view isn't the place to be doing this.
      The view that returns the Json should be in another one, not the same. And preferably in another application.
      The filtering shouldn't be done from filter() directly, a custom manager or queryset should have been defined and a custom method like "by_user()" should have been used.
      The project uses the Chat model directly to create new objects. This is VERY VERY WRONG AND DANGEROUS. You should ALWAYS sanitize data coming from the frontend. Django has a forms framework that helps you do this ultra easy. Worse, this same data is used for a call to chatgpt's API.
      This same pattern is used in the login and registering.
      The project is also missing tests, but most tutorials don't usually include those.
      There's probably more stuff that I've missed, but the conclusion is that the person that made this tutorial isn't experienced enough with web development nor django. This is fine, we all start from 0 and learn. The problem is that this is a tutorial in a programming learning channel with 9.3 million subscribers. People will learn from here and use this code for real applications, and by doing so make stuff filled with bad practices and vulnerabilities.

    • @Famelhaut
      @Famelhaut 10 місяців тому

      @@vishnuhunnithan3086
      You're right, I should have elaborated.
      The project doesn't have a gitignore, requirements txt or a pyproject toml file. It wasn't made with dependency or package management in mind, or from a project template. This is why the sqlite3 database and pycache files were committed to the project.
      The production secrets are hardcoded in the code instead of being imported from enviroment variables with something like python-dotenv or better yet, from the system itself.
      There are only development settings. In a real application you would either have another settings file for production or another branch with all the production settings.
      The templates aren't namespaced to the app. The Django tutorial explains very well why this is important.
      The chat model uses the User model directly. You should never do this, and instead create a new User model from the AbstractUser class. The Djando docs explain why aswell.
      The templates define the style directly. This should be in a specialized css file that is imported in the base html.
      The base html template uses cdns, you shouldn't use cdns in production unless you're the owner of them. It also imports bootstrap, so I wonder why even have custom styles in the templates.
      The register and login templates can probably be simplified, but it's not a big problem.
      The chat template uses vanilla js when jquery was imported in the base. The code should either be using jquery or base html shouldn't use the jquery cdn.
      The chat template uses vanilla js in a script tag, it should be in another file specialized js file.
      The js code is fine, altough I would have personally used htmx instead of json.
      Now, the biggest problems are in views py:
      This project should have used websockets with django-channels instead of doing rest-like ajax requests. Chat applications need to be responsive to requests and don't follow the REST pattern very well, this is why if you use any chat application like discord, whatsapp, telegram, etc and switch to the network tab, you'll see that they use websockets. For a simple demonstration project it's fine, but it should have been done with websockets. The django-channels tutorial teaches you how to make a chat application.
      Leaving that aside, there are other problems in views py:
      ask_openapi shouldn't be in views py. It's not a view, it should be in utils py or services py or anywhere else.
      The project only uses functional views. These don't scale, and will only bring problems down the road if you don't refactor them into class-based-views. The project should have overriden one of the generic views from django with the additional needed functionality or written one from scratch by inheriting from View.
      login and register shouldn't exist. Django comes with pre-defined, customizable class-based-views for login, logout and changing password. registering can be done using the default UserCreationForm and a CreateView. The only thing that isn't done for you are the templates.
      The project shouldn't have a a view returning Json data, this should be handled with a serializer, with either django-rest or django-ninja. The view isn't the place to be doing this.
      The view that returns the Json should be in another one, not the same. And preferably in another application.
      The filtering shouldn't be done from filter() directly, a custom manager or queryset should have been defined and a custom method like "by_user()" should have been used.
      The project uses the Chat model directly to create new objects. This is VERY VERY WRONG AND DANGEROUS. You should ALWAYS sanitize data coming from the frontend. Django has a forms framework that helps you do this ultra easy. Worse, this same data is used for a call to chatgpt's API.
      This same pattern is used in the login and registering.
      The project is also missing tests, but most tutorials don't usually include those.
      There's probably more stuff that I've missed, but the conclusion is that the person that made this tutorial isn't experienced enough with web development nor django. This is fine, we all start from 0 and learn. The problem is that this is a tutorial in a programming learning channel with 9.3 million subscribers. People will learn from here and use this code for real applications, and by doing so make stuff filled with bad practices and vulnerabilities.

    • @Famelhaut
      @Famelhaut 10 місяців тому

      ​@@vishnuhunnithan3086
      You're right, I should have elaborated.
      The project doesn't have a gitignore, requirements txt or a pyproject toml file. It wasn't made with dependency or package management in mind, or from a project template. This is why the sqlite3 database and pycache files were committed to the project.
      The production secrets are hardcoded in the code instead of being imported from enviroment variables with something like python-dotenv or better yet, from the system itself.
      There are only development settings. In a real application you would either have another settings file for production or another branch with all the production settings.
      The templates aren't namespaced to the app. The Django tutorial explains very well why this is important.
      The chat model uses the User model directly. You should never do this, and instead create a new User model from the AbstractUser class. The Djando docs explain why aswell.
      The templates define the style directly. This should be in a specialized css file that is imported in the base html.
      The base html template uses cdns, you shouldn't use cdns in production unless you're the owner of them. It also imports bootstrap, so I wonder why even have custom styles in the templates.
      The register and login templates can probably be simplified, but it's not a big problem.
      The chat template uses vanilla js when jquery was imported in the base. The code should either be using jquery or base.html shouldn't use the jquery cdn.
      The chat template uses vanilla js in a script tag, it should be in another file specialized .js file.
      The js code is fine, altough I would have personally used htmx instead of json.
      Now, the biggest problems are in views py:
      This project should have used websockets with django-channels instead of doing rest-like ajax requests. Chat applications need to be responsive to requests and don't follow the REST pattern very well, this is why if you use any chat application like discord, whatsapp, telegram, etc and switch to the network tab, you'll see that they use websockets. For a simple demonstration project it's fine, but it should have been done with websockets. The django-channels tutorial teaches you how to make a chat application.
      Leaving that aside, there are other problems in views py:
      ask_openapi shouldn't be in views py. It's not a view, it should be in utils.py or services.py or anywhere else.
      The project only uses functional views. These don't scale, and will only bring problems down the road if you don't refactor them into class-based-views. The project should have overriden one of the generic views from django with the additional needed functionality or written one from scratch by inheriting from View.
      login and register shouldn't exist. Django comes with pre-defined, customizable class-based-views for login, logout and changing password. registering can be done using the default UserCreationForm and a CreateView. The only thing that isn't done for you are the templates.
      The project shouldn't have a a view returning Json data, this should be handled with a serializer, with either django-rest or django-ninja. The view isn't the place to be doing this.
      The view that returns the Json should be in another one, not the same. And preferably in another application.
      The filtering shouldn't be done from filter() directly, a custom manager or queryset should have been defined and a custom method like "by_user()" should have been used.
      The project uses the Chat model directly to create new objects. This is VERY VERY WRONG AND DANGEROUS. You should ALWAYS sanitize data coming from the frontend. Django has a forms framework that helps you do this ultra easy. Worse, this same data is used for a call to chatgpt's API.
      This same pattern is used in the login and registering.
      The project is also missing tests, but most tutorials don't usually include those.
      There's probably more stuff that I've missed, but the conclusion is that the person that made this tutorial isn't experienced enough with web development nor django. This is fine, we all start from 0 and learn. The problem is that this is a tutorial in a programming learning channel with 9.3 million subscribers. People will learn from here and use this code for real applications, and by doing so make stuff filled with bad practices and vulnerabilities.

    • @yahhdsad3041
      @yahhdsad3041 10 місяців тому

      @@vishnuhunnithan3086
      You're right, I should have elaborated.
      The project doesn't have a gitignore, requirements txt or a pyproject toml file. It wasn't made with dependency or package management in mind, or from a project template. This is why the sqlite3 database and pycache files were committed to the project.
      The production secrets are hardcoded in the code instead of being imported from enviroment variables with something like python-dotenv or better yet, from the system itself.
      There are only development settings. In a real application you would either have another settings file for production or another branch with all the production settings.
      The templates aren't namespaced to the app. The Django tutorial explains very well why this is important.
      The chat model uses the User model directly. You should never do this, and instead create a new User model from the AbstractUser class. The Djando docs explain why aswell.
      The templates define the style directly. This should be in a specialized css file that is imported in the base html.
      The base html template uses cdns, you shouldn't use cdns in production unless you're the owner of them. It also imports bootstrap, so I wonder why even have custom styles in the templates.
      The register and login templates can probably be simplified, but it's not a big problem.
      The chat template uses vanilla js when jquery was imported in the base. The code should either be using jquery or base.html shouldn't use the jquery cdn.
      The chat template uses vanilla js in a script tag, it should be in another file specialized .js file.
      The js code is fine, altough I would have personally used htmx instead of json.
      Now, the biggest problems are in views py:
      This project should have used websockets with django-channels instead of doing rest-like ajax requests. Chat applications need to be responsive to requests and don't follow the REST pattern very well, this is why if you use any chat application like discord, whatsapp, telegram, etc and switch to the network tab, you'll see that they use websockets. For a simple demonstration project it's fine, but it should have been done with websockets. The django-channels tutorial teaches you how to make a chat application.
      Leaving that aside, there are other problems in views py:
      ask_openapi shouldn't be in views py. It's not a view, it should be in utils.py or services.py or anywhere else.
      The project only uses functional views. These don't scale, and will only bring problems down the road if you don't refactor them into class-based-views. The project should have overriden one of the generic views from django with the additional needed functionality or written one from scratch by inheriting from View.
      login and register shouldn't exist. Django comes with pre-defined, customizable class-based-views for login, logout and changing password. registering can be done using the default UserCreationForm and a CreateView. The only thing that isn't done for you are the templates.
      The project shouldn't have a a view returning Json data, this should be handled with a serializer, with either django-rest or django-ninja. The view isn't the place to be doing this.
      The view that returns the Json should be in another one, not the same. And preferably in another application.
      The filtering shouldn't be done from filter() directly, a custom manager or queryset should have been defined and a custom method like "by_user()" should have been used.
      The project uses the Chat model directly to create new objects. This is VERY VERY WRONG AND DANGEROUS. You should ALWAYS sanitize data coming from the frontend. Django has a forms framework that helps you do this ultra easy. Worse, this same data is used for a call to chatgpt's API.
      This same pattern is used in the login and registering.
      The project is also missing tests, but most tutorials don't usually include those.
      There's probably more stuff that I've missed, but the conclusion is that the person that made this tutorial isn't experienced enough with web development nor django. This is fine, we all start from 0 and learn. The problem is that this is a tutorial in a programming learning channel with 9.3 million subscribers. People will learn from here and use this code for real applications, and by doing so make stuff filled with bad practices and vulnerabilities.

  • @naspy971
    @naspy971 Рік тому +5

    Django ? This sh*t is still alive ?

  • @chordiasankalp820
    @chordiasankalp820 Рік тому +5

    Not well explained

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

      Would love to see how you'd 3x0lain it better.

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

    رررع

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

    hi right now ghat gpt doesnt offer any free api we should buy chatgpt4

  • @sukuna1374
    @sukuna1374 Рік тому +1

    can any one tell me how to open the db.sqlite3 file it says ( file is not displayed in the text editor because it is either binary or uses an unsupported text encoding)

  • @briansalvator31
    @briansalvator31 Рік тому +1

    I keep getting this error. openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.

    • @m4y4nknyon34
      @m4y4nknyon34 Рік тому +1

      same i don't know how to make it right

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

      you need to sign up for a new account since your api free trial expired, this happened to me too and i made a new account

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

      Your api token is deprecated. Add card info and try again with new token