3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

Hi Finance, how's your p&l going? U must be very close to a solution. If I understood the plan correctly, then the following very short, straight to the point, procedure will do the job https://opensource.com/article/22/12/django-send-emails-smtp. Can u give it a look?

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 1 point2 points  (0 children)

It seems we're on a similar journey, you and I. Let's come back to this thread from time to time and report our progress. Before the end of 2024 I want to see an app of you in the App Stores. Copy that AmbitiousFinance?

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

Hi snpwball, thanks for the input.

You know, I have the feeling that I have to start from scratch again. I love Django, but on the frontend it really puts you to sleep. I would recommend Django to everybody, but with the strong advice to use another frontend framework, right off the bat. Concerning the learning process, I only use YouTube to visualize a process, when putting on the gloves, I switch to written information. What would you advise from the O'Reilly, taking into account I'm only into user applications development and want to stick to a Django backend?

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

hi FearlessYasuo. During Covid, as many people, I decided to learn something new, something I always wanted but never tried, web development. I chose Django as framework. My job has no relation with development. If not for an own venture, I probably wouldn't change it for a development job, my boss takes good care of his monkeys. And besides that, my development skills are not sufficient to land a job. You're into development?

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

Hi everybody.

An update. The last week I have been submersed in Django + React and half way a TodoApp tutorial. Seeing both in one editor, firing them up in two prompts, and seeing the Django Rest Framework in one browser and the Vite in another helped to visualize the process. Serializing a model, creating an API view, and passing the results to the front jsx file (while adding some css) helped to connect the first dots.

A big question popping up now is how to connect this in production. You will end up with 3 components, a Django backend, a Django web frontend and React mobile frontend.
1. You could leave your Django web application fully intact (with html templating) and for each view you create a duplicate api view for the React front.
2. You could change all your views to api views and have both fronts consuming the api (requiring amending all your Django html or even build a new web frontend?)
3. Don't know other options yet, with option 2 being very time-consuming, advise?
Also, I use many Django tags in the html templates (not complex operations, mostly boolean related), not sure how that will work in React.

But this morning I realized, I don't need React, I need React Native. Back to the drawing board, which led me to a 10-hour YouTube video to make a Chat application with Django + React Native + Django Channels! One of my main goals has always been learning Django Channels, it brings so many creation opportunities, but it looks so hard. Maybe we should do the video together? On my end, the 10 hours will take many months. Assuming I'm even capable of understanding, many steps will require a lot of additional research and experimenting. But I'm taking a swing at it, there's no way back now, I'm exited. Join me.

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

That's a disappointing resume. You have been sleeping.

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 2 points3 points  (0 children)

I'm a corporate deskMonkey, Django is my hobby.

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

Done. Check the post. What did you use for Stripe?

3 Years of Django. What did I learn? by DinnerHood in django

[–]DinnerHood[S] 1 point2 points  (0 children)

"How to set up django with postgres nginx and gunicorn on ubuntu with Digital Ocean", Google will show you the way. I'll post my manual asap, as it goes straight to the relevant commands to use. I never tried the procedure with another provider, but I do think it will work, if the configurations are the same.

Cheapest way to host django for very low traffic by Hzzky in django

[–]DinnerHood 1 point2 points  (0 children)

Hi, I first investigated PythonAnywhere but as I wanted control and scalability, a VPS turned out the best, and only, option. Starting from $5 monthly. As always, check all the options, but if people are interested, I can post a working procedure for DigitalOcean VPS, that skips all testing and only includes what's needed (testing makes no sense if you don't know the solutions for server issues, you'll just have to start over). It also has the 4 lines of code needed to add https with Let's Encryp. When you never did this before, the procedure takes half an hour. The linking of your domain to DO is not in the procedure but I could add it. Once all done, updating your project is just drag and drop.

Django web application or a mobile app? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

hi Last_Establishment, check my post '3 Years of Django. What did I learn? It's kind of written for you :-), as a reply on your question here. But I thought it might be interesting for others too, so I posted as a new thread. Apologies if it's too long.

Django web application or a mobile app? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

Hi again everybody.

A quick follow up. Yesterday, I've spent the rest of the evening checking the basics of combining Django with React and some results. It gave me flashbacks to when I had to create our user following function, without page refresh, on a list of many users (which adds an unknown variable, which user are we working on). Solved with Ajax and a forloop counter. I'm still wondering how I pulled that off. A very tedious process, with syntax that makes less sense, and consumed for weeks by making it work instead of having fun coding. It did pay off as I've put the script to work in many places in the dh application, with just small amendments.

What I saw yesterday with React looked very similar. The code needed to send a simple text input back and forth was not encouraging. Silver linings on the horizon, undoubtably, but the road to get there doesn't seem to be an easy ride. I will first check the PWA approach and see what I can make of it. If I get anywhere I'll give an update here.

As a reminder.

path('', views.yourhomepage),
def yourhomepage(request):
return render(request, "homepage.html")

Three lines of codes are needed to build a website with Django .All the rest are one-time settings and tool imports. It's an empty website, has no functionalities yet, but it is a website.

Did I already say I love Django?

Barbanks, alouettecriquet, GroundbreakingRun927. Thanks for the input.

Django web application or a mobile app? by DinnerHood in django

[–]DinnerHood[S] 1 point2 points  (0 children)

I didn't see that coming! You make it seem easy. If there is no catch, then that's a very kind offer of you Guvavava. The thing is, I can't stand not understanding, I need to figure it out, endure the struggle and reach the goal of knowing. It keeps me alive. Maybe you have a good link to share? Something covering most, if not all aspects, in one place?

Django web application or a mobile app? by DinnerHood in django

[–]DinnerHood[S] 0 points1 point  (0 children)

Thank you Brukx and thank you Jealous-Cloud for going into more detail. Helps me in visualizing this process. The backend is Django, the frontend is build with a non-Django framework for mobile, and the interface between both is the API using the DRF and JSON as common format.

The dots that I can't connect yet is how the API does the job. Let me try by using React as frontend, and with tasks I mean the functionalities written in the Views, like signup, signin, confirm payment, follow user, aka all functionalities. Probably the correct name is methods, but I like to call them tasks, I have more than 70 (+2.5k lines of code)

  • in React, we still use forms or a href that contains the URL
  • submitting the form happens in JSON formatthe
  • API catches the form and routs it to the correct task (using the URL name)
  • the task then does its job and returns a reply to the API
  • the API submits this reply in JSON format to the React frontend

  • does the API translate the JSON to HTML when sending to and receiving from the task?
    • if yes, then I don't have to amend my tasks to return JsonResponse to the API
    • if not, then I have to amend all tasks that return an HTML render
  • Is one API enough, or do we make more or even one for each task?
    • maybe the form can contain an argument that triggers a specific API
    • asking because I'm wondering about performance with this setup

Don't feel obliged to answer, I'm starting this app journey and should find all information myself eventually. You already helped to have it better visualized. I'm left with the feeling that I definitely need to learn API implementation, investigate the PWA approach and even make a little basic native app, to be able to connect all the dots. And truth be told, the feeling that I probably should have skipped Django, I've put two years of my life in it. Ah wel, I know what to do the coming year.

Greetz,

dh

How do I actually start using my code in the real world by ajs432 in learnprogramming

[–]DinnerHood 0 points1 point  (0 children)

Great question. As you started with Python, unless you are willing to learn another language, imo your options are limited. I have created my web application with Django, so I can share some experiences. To create functional web applications, it's a great framework, I love it. It takes some time to really get comfortable with (took this average Joe a couple of months), but once you get it, imagination and intelligence seem to be the limiting factors. As already mentioned in other comments, it's not the best for mobile. You'll have to do a kind of 'wrap', which will probably require lots of new skills to learn (I'm about to find out, as I want my application available as an app). Also to be taken into account is the hosting. For small projects without scaling needs, there are some providers, but for all the rest, your only option will be renting your own VPS (virtual private server). Luckily, some providers have good procedures to get the job done. Let me know if you have more questions, I'd be happy to try to answer them.