syedj
I have 2 apis one is rest api which calls rest and update the database (the rest api contains project details). So data base have to be updated if a project has been added or removed periodically
syedj
Second will fetch from that db and display on the web
Code9
What server environment are you on?
syedj
So 1st api have to run periodically for second one to be correct
syedj
Django and django rest
Code9
Django and django rest
But are you hooking that with a web server?
syedj
Hooking?
Code9
while django itself can serve a site, it is recommended that you use a web server to host the thing e.g. Apache / nginx
Code9
anyway django is only responsible for handling the content once a request is received
Code9
as for when a request is sent, it's out of the scope
Code9
so you should do that with cron / celery
syedj
Ok will look into celery
syedj
Thanks
Anonymous
Is there a way to run image processing code on django?
R
Many options https://djangopackages.org/grids/g/photos/
syedj
Use celery-beat or django-q
Is it different from celery?
Code9
Is it different from celery?
what OS are you using
syedj
Windows 10
syedj
For developing
syedj
But will run it in on linux
syedj
After developing
Code9
Windows 10
windows: task scheduler
Code9
linux: celery / cron job
Code9
google them up and ask if you have any questions
syedj
Celery-beat different from celery?
Anonymous
I'm new to this django and I'm gonna use it for my final year project. I just wanted to make a simple page and whenever i visit that page the image processing code should run in background (on servers). So can you help me with that😅
Anonymous
Anonymous
Later I'll it on hosting server
Anonymous
I'll send you that soon
Mirco
Is it different from celery?
Nope, they do the same job but imho django-q is a bit better and you don't need another dependency ( celery-beat ) It's all battery-included
Mirco
celery beat is a fork i think (can someone confirm?)
celery-beat is specifically to schedule tasks celery allows to make async tasks etc.
Harsh
I want to learn django please share or give any resource
Бакыт
Hey,Guys, I am trying make search from user select options as in sreenshot 1)What is a better way to accomplish this ? 2)So far I try to use Form for that Here what I got forms.py class FlatForm(ModelForm): class Meta: model = Flat fields = ['rooms', 'category', 'district'] view.py def topsearchbar(request): if request.method == "POST": form = FlatForm(request.POST) if form.is_valid(): rooms = form.cleaned_data.get('rooms') district = form.cleaned_data.get('district') category = form.cleaned_data.get('category') founded_results = Flat.objects.filter(rooms=rooms,district=district,category=category) print(form.cleaned_data) data = form.cleaned_data print(data["rooms"]) else: print("didnot work") form = FlatForm() return render(request, 'topsearchview.html', locals()) But,the problem is that whenever user does not select any options it becomes None,I want to make it to Any if user does not select any options {'rooms': None, 'category': <FlatCategory: Стандарт>, 'district': <FlatDistrict: ЦОН>}
Anonymous
Hi guys I have a couple of questions, pardon me if it's kindergarten. So off recent I started using Django rest framework having used Django for a while now, I use Vue for front end now. So I wanted to ask I) while making use of Django templates once a user is logged in, we know we just need to use @login_required(), because the system is aware of that the user is logged in, How do I acheive this in DRF, because Everytime I keep sending the User Pk to access the user table first. 2) I recently read about JWT and tried implementing it in a sample project, Now not all URLs in my project requires an authenticated User, How do I prevent Jwt from this Classes
Mirco
Django-q is for querying the databases 🤔
absolutely not, django-q is for managing tasks Django Q is a native Django task queue, scheduler and worker application using Python multiprocessing.
Akash
Can I modify django default User table name to be something else? I have an existing database that I use for a subscription service which already has a "User" table, I tried to use same database in django it created some extra columns in my User table but login ad stuff does not work correctly now. What would be correct way to connect the existing service with new Django app
Akash
By running inspectdb command you can put your existing tables into Django
Yeah I did same inspectdb created the models and I used same db in my database but seems the login function does not work now
Akash
What kind of error do you get ?
I do not see any error. but when I do login(user, request) it always return AnonymousUser
feggy
is there any frontend framework which isn't JavaScript?
Anonymous
Hi Guys i am trying to submit form using html and with the input data i am trying to get the details from database and returning to template with context but template is rendering without context why this is happening ....Form Code in HTML <form method="post" action="{% url 'cdgslots' %}"> {% csrf_token %} <input type="text" name="city" id="search" onclick="clearSearch()" <input type="text" name="datetimes" value="01/01/2018 - 01/15/2018" class=" form-control no-border simplebox" /> <div class="col-md-1 fire-btn"> <button type="submit" class="btn fire">Fire</button> </div> </div><!-- arth-boxes --> </form> VIews Code class CDGSlots(TemplateView): def post(self, request): context={} if request.method == 'POST': context['city'] = City.objects.all() context['CDGSlots'] = "Sorry We Didn't Find Rooms For You" else: context['NoRooms'] = "Sorry We Didn't Find Rooms For You" return render(request, 'fapp/rooms.html', {'context':context})
syedj
Django-q is for querying the databases 🤔
Celery does it work on Windows 10?
.
Celery does it work on Windows 10?
honestly Windows is not suitable for developing Django
.
I reccomend to use Docker on Windows
Anonymous
that's also out of the scope of django can you show your code
https://gitlab.com/vivekpavaskar/emodetct The code is still in development
Anonymous
Code9
@CookieFP you can see the code in the above link
Looks like you have installed Django, but haven’t used started a Django app yet
Code9
Please read the tutorial first
Anonymous
https://gitlab.com/vivekpavaskar/emodetct The code is still in development
No no, this is just python code for image processing
Anonymous
I want to make this code run on server using django
Anonymous
It will start processing the image extracted from video
Anonymous
I'm following this tutorial https://medium.com/quick-code/crud-app-using-vue-js-and-django-516edf4e4217 But I'm lost here: After it adds this line to urls.py path('article', TemplateView.as_view(template_name='index.html')), It tells you to: Below this we will create a vue js instance inside script tag But I don't understand where to put these codes that are "inside script tag" Which file does it mean? Wich part of that file?
Code9
Ghorz
How do you guys handle inserting messages / html in running projects. Lets say you need to take the site off line for 2 minuts, how do you warn? Template IF presence of a html fil insert or something ?
For me I'll add the value to database, pass the value to template context processor. In base template I'll use if statement to render template based on database value
Ghorz
That's exactly what I landed on
Sure youve implemented it I believe
Anders (izzno / gooood) 🇳🇴
The only bad thing is without an active admin site/page this value has to be set in psql client.
Anders (izzno / gooood) 🇳🇴
But I could just make a simple formpage for superusers...
Mirco
cj
🙄
Anders (izzno / gooood) 🇳🇴
Mirco
Warnings about eminent reboot / upgrades.
Gotcha Yup, I agree with the solution you talked about before
Aadhi
Could anyone help me to perform join operation in Django.
Anonymous
2019-03-26 08:00 AM - 2019-03-31 04:00 PM how can i split above date string as in = 2019-03-26 out =2019-03-31 inTime = 08:00 AM outTime = 04:00 PM In Django