Django

For discussing topics related to Django, a high-level Python web framework. Ideal for sharing tutorials, updates, trouble-shooting tips, and best practices in Django development.

codie
codie

Alright folks, let's cut the crap. We know web dev can be a brutal grind. Django for the backend, SvelteKit for the frontend—sounds perfect, until you try to make them work together. Endless configs, dependencies throwing tantrums, and a heap of wasted nights.Pain In The Ass? Let’s Fix It 🎯We’ve all been there:Backend Ready: Django's solid, backend is rolling.Frontend Dream: SvelteKit is ready to dazzle.Reality: Integration is a flaming dumpster fire. 🔥Enter Django Svelte Template 🦸‍♂️Screw the headaches. This template is your knight in shining armor. Pre-configured, smooth as butter. Clone it, run it, done.🚀 Getting Shit DoneClone the Repogit clone [email protected]:Bishwas-py/django-svelte-template.git Fire Up Django Backendcd django_backend python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python manage.py migrate python manage.py runserver Spin Up SvelteKitcd svelte_frontend npm install npm run dev Set .env:SECRET_BASE_API=http://localhost:8000 Boom! You’ve got a working todo app to play with.Why Use This?Backend Power:Django: Steady and reliable.Djapy: Enhanced validation, swagger in dark-mode.DjangoKit: Smooth Django-SvelteKit integration.Frontend Magic:Svelte 5: Reactive, quick.@friendofsvelte/django-kit: Seamless connection to Django.Tailwind CSS: Style without the hassle.Insta-FeaturesAuto Flash Messages: Toasts on errors, no sweat.Form Handling: Handling & validation, out of the box.Notifier Store: Easy to use toast notifications.Why Give a Damn?Plug and Play: No more setup nightmares.Full-Featured: A ready-to-use todo app to kickstart your project.Seamless Integration: Django and SvelteKit are besties here.Ready To Roll? 🏎️💨Head to the repo, fork it, clone it, and start building. No more late nights swearing at broken builds. Just smooth, painless dev.Let's code smarter, not harder. 🌟Contributions are welcomed!

cemen1 replied a month ago
cool one, thanks for sharing!
Published a month ago
2 likes 101 watched 2 commented
codie
codie

Hey Devs.I started learning Django in COVID times. I was on my grade 12th ATM. I was into content writing and stuff. I had a site, and there was a tool named "Adsense Eligibility Checker" in my site, where user could fill the form, submit their site, and I'd check if there site is eligible or not. The requests were a lot, and task was tedious.I wanted to build something where my presence would not be required. So, I started searching for ways to make a tool/webapp. I was already into learning Python, so maybe fate wanted or something, I got to know about Django.I started learning it. It took me three weeks to nicely learn and 2-3 weeks to develop that tool. I was super happy, wanted to deploy on my cpanel-shared-hosting based server, I had to suffer a lot at that time. But does tons of searches, I deployed it. It got popular, I attached Google Ads on that platform, made a little good money, travelled to places in Nepal.My father's friend used to do Fiverr in Poland, and she suggested me to do so. I had some old Fiverr gigs added, but removed them (were primarily for Photoshop editing). Add a gig, "I'll deploy Django on cPanel", after 2 days of adding that gig, got an order from a Morroco-ian guy. Delivered it. And my journey boosted.I kept doing indie dev and freelancing. After 2 years, my revenue were not doing so well. Had to apply for a job, got the job, worked there for 5 and a half months, and US-based company named "Blogstorm.AI" offered me a job with comparatively good salary, started working there. It's been 1 and a half years working on blogstorm.Now, I am doing full-time job, indie dev and open source. There's a Django rest API framework, that I am working, called Djapy.IO . The journey is going good. I have migrated all my platforms code to Djapy.I hope to see some new guys in there. Life is good man, so is Django. Have a great day. For suggestions, believe on process.

Zaeemusmani replied 4 months ago
Noce good lovly
Published 4 months ago
3 likes 1664 watched 3 commented
codie
codie

Django Recaptcha v3 will be installed in your Django website soon, just follow my instructions. We will be using Google Recaptcha version 3 ( I am not a robot ) and a Python library django-recaptcha for this task.This is a repost of an old blog of ours.How to install, deploy or integrate Django recaptcha v3?Django recaptcha v3 installationFirst, install django-recaptcha in your virtual workspace.Visit the GitHub Repo of this task/project to get all the source codes.Install and configure django-recaptcha libpip install django-recaptchaNow, add captcha in the INSTALLED_APPS section in your settings.pycaptchaMust be similar to this:INSTALLED_APPS = [ 'captcha', # add this code 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', "your_app_name", # app name ]Recaptcha keys configurationAdd RECAPTCHA_PUBLIC_KEY and RECAPTCHA_PRIVATE_KEY at the last lines of your settings.pyRECAPTCHA_PUBLIC_KEY = 'MyRecaptchaKey123' RECAPTCHA_PRIVATE_KEY = 'MyRecaptchaPrivateKey456'Here, RECAPTCHA_PUBLIC_KEY means SITE KEY and RECAPTCHA_PRIVATE_KEY means SECRET KEY.Now, go to Google reCAPTCHA admin panel and register your site for reCAPTCHA and use those data in the upper code.Cpatcha Form configurationNow, create a file named my_captcha.py and inside it you need to write the following Python codes:from django import forms from captcha.fields import ReCaptchaField class FormWithCaptcha(forms.Form): captcha = ReCaptchaField()Django views configurationWrite a context with "captcha" variable name that with render the form we have coded in FormWithCaptcha which is inside the my_captcha.py .from django.shortcuts import render from .my_captcha import FormWithCaptcha # Create your views here. def home(request): context = { "captcha": FormWithCaptcha, } return render(request, "home.html", context)Rendering recaptcha v3Now, we are rendering recaptcha using the Jinja template method. Use {{captcha}} for rendering the captcha form.For now, have a look here:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <forms> {{captcha}} </forms> </body> </html>Getting data from recaptcha formTo get data from django recaptcha, you need to use g-recaptcha-response.get_recaptcha = request.POST.get("g-recaptcha-response")This will return true if the checkbox is checked, else false.

codie replied 4 months ago
You might also wanna check this video:https://youtu.be/8GNc4Pz4is4
Published 4 months ago
0 likes 664 watched 1 commented