#web-development
2 messages · Page 95 of 1
Also I think Asana can do this as well, but it has a lot more features and can become confusing real quick, but that's just my opinion
Right, i get it. I like the kanban based things, but i can't get around this "finished" or "done" columns. Why are they even alive?
I have thought about making it visually nicer
more modern
because it was cool, but i think it's outdated
You cant see the list of subtask with the main task in kanban, you have to always open one..
I mean
they can eventually be archived for cleanup purposes
so that you only have the latest changes in them and the historical ones are archived
guys do you know how to save images as binary files in database??
I guess, it depends on your workflow and requirements
@fickle fox you shouldn't tho
which Framework ?
I guess, it depends on your workflow and requirements
@marble carbon Yeah i know. I'm just trying to get a better overview of the market by asking ppl around
and why not
@fickle fox propably you should just store the file path in db
and the exact file on the server pc
or some 3rd api that gives you back the url
you store the url and get the files through it
no don't save file in db
it'll slow down your queries over time
save them on disk and just store the path in database
like i said 😛
@sudden grail how many people are in your team
Basecamp is better and more advanced than Trello tbh
that's more developer focused
I have usually seen devs ranting about Asana xD
@marble carbon iam alone. I just wanna make my own product but there are two ways of doing this. I want a simple solution, but useful. Like trello was in his ages
Hmm you see
I just want to get a small piece of the cake you know
to me Trello seems perfect because, when you have multiple tasks on your board
and you only display title, it's good and more focused, showing the details of each task might get overwhelming
there's also Github Projects now
but it has less features as compared to Trello
no comments on Tasks
no attachment etc
I think it's similar to Asana, haven't got the chance to use it
it seems more focused on teams
oh hmm there's no priority system in Trello tho, I do it instead with Labels and due date
Monday seems to have it
I mean if we keep the conversation here, others might be able to pitch in their experiences as well
in DM you might miss out on those insights
I am working on a Trello like system also, I mean I want to implement so new features so I dont think I would share, Gergo is looking to monetize any ideas that he sees are missing, to get a competitive edge over current competitors
Also no calendar view, but hey it's free, Monday has no free tier
Point being I dont really share ideas publicly when its purpose is to be monetized.
Yeah it's alright
wait
@sudden grail are you planning to make a Trello like tool yourself?
I think I totally missed that part

I just want to get a small piece of the cake you know
@sudden grail Yea
Oh hmm
@sudden grail are you planning to make a Trello like tool yourself?
@marble carbon yeah
lol then you should do all this research yourself xD
Thats why iam asking bro
I try to better understand the market
Eh but if you ask in a dev community any ideas you get would be like instantly worked on by others in here that find it interesting
Django in the back and react on front
lol okay
I just try to understand and figure out who are using calendar based tools and trello like apps
What are the personas
Or teams
Popular Alternatives to Trello for Web, iPhone, Android, Windows, Mac and more. Explore 25+ apps like Trello, all suggested and ranked by the AlternativeTo user community.
this, and read discussions over forums such as Hacker news about task management tools
you'll be able to get an idea about the types of users
The hard part is marketing though, especially with 0 funds...
Yeah, maybe producthunt, but it has to be visually pleasing to make a cut there ig
So it can be quite succesful if the marketing is good? @haughty turtle
give me trello with an audocad like cli
Yeah, maybe producthunt, but it has to be visually pleasing to make a cut there ig
@marble carbon yeah i visit this site often
it's weird, but I really like the fusion approach
🧐
Oh HA
i want to be able to drag or mv tiles*
we all get lifetime free plan, if it turns out to be product tho
Lool yeah
Ofcourse you get @marble carbon
is my pfp still moving
gif privileges revoked
gone??
maybe it's just me
auth_views.LoginView.as_view(template_name='users/login.html')```
When pointing to my template w/ template_name, CSS isn't picked up (but with return render() within a view it is). Does anyone know how to fix this?
o.o you can pass in template_name directly into as_view()
did not know that, where is your model at @native tide
my model?
are you using django?
yea
my css file? my html file?
I don't understand what you mean by that. I'm new sorry
Are you not passing in a object from a Model?
no...
Is it possible to filter down an html table that is populated from a database using a dropdown menu with values from the database as well? I've been using flask for this project with the front end being formatted with assistance from wtforms.
probably w React and some APIs
in your views are you importing from django.views import generic? @native tide
As before you where using render from django.shortcuts but now you switched to a generic call
well wherever you are using it import generic from django.views
are you are trying to use a generic template from django
instead of rendering
also when I followed Django tuts it calls template name inside of views. @native tide but if you are going to use it inside of urls you still have to import generic still I would imagine
also why did you import render into urls if you are not using render o.o
@native tide
I was just trying render to see if it would do anything, but it didn't.
I'll read into django.views import generic, can you explain what it does?
of course wont do anything if you arent calling render, but why are you trying to render directly from urls, I wouldnt recommend it
how would you handle any errors needed
import generic is just a even shorter version of using render.
no I'm not trying to use render, I was just experimenting
I'm trying to use auth_views.LoginView.as_view but I can't get the CSS loaded through it
but if I use a view with render(template-name) the CSS is loaded
this is inside of views
from django.views import generic
class DetailView(generic.DetailView):
model = Question
template_name = 'polls/detail.html'``` this is how my view looks inside of Django
Ok. So since LoginView is predefined, can I customize it?
LoginView is supposed to reference a class in your views
such as DetailView, that is what your LoginView should represent @native tide
Oh I didn't know
But what tut are you following, o.o
You should not be that lost.
Lol I just got into the generic views part of Django like literally 2 hrs ago, and here I am helping you right away
Yeah create the class LoginView
The Django tut on the Django website is pretty straight forward.
I am watching some of the NewBoston Django vid, but not coding while watching as I see how he builds the song playlist app.
Just to see how he works passing in real data to Django, but other then that you should get used to reading from documentations
@native tide it will make your life much easier
what does Corey Shafer build in his tut
Some sort of social media app
But thanks I think I'm just gonna follow django tut
and using the parts that I want for my own projects instead of following others
yea, if you want then watch Corey Shafer afterwards but not code just watch how he implements the social media part into django
@native tide
guys, any tips on how to receive post requests?
i'm using flask, the post request happens, but when i print the request, returns None
i'm using postman to test
Hello guys, could you explain please, difference between this types of declarations namespaces for urls?
First one we define app_name first, in second one we dont, but using include() with extra str ` app name'
First declaration
# blog/urls.py
app_name = 'blog'
urlpatterns = [
# post views
path('', views.post_list, name='post_list'),
path('<int:year>/<int:month>/<int:day>/<slug:post>/',
views.post_detail,
name='post_detail'),
]
#urls.py root
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls', namespace='blog')),
]
Second declaration
# blog/urls.py
urlpatterns = [
# post views
path('', views.post_list, name='post_list'),
path('<int:year>/<int:month>/<int:day>/<slug:post>/',
views.post_detail,
name='post_detail'),
]
# urls.py
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include(('blog.urls', 'blog'), namespace='blog'),
]
@grizzled sand in the second declaration you are declaring the app name in the include, unlike in declaration 1 where you declared it in the blog url.py
"include()
include(module, namespace=None)
include(pattern_list)
include((pattern_list, app_namespace), namespace=None)
A function that takes a full Python import path to another URLconf module that should be “included” in this place. Optionally, the application namespace and instance namespace where the entries will be included into can also be specified."
How can i get the url path by its name...like
path("some-pattern/", views.someview, name="Log-In")
In this...i want the url pattern by name Log-In
Found it! Nvm
@proud meteor what's your issue?
Can someone help me with this, i have no clue why im getting this now.
Hey guys, I've recently started learning Graphene, I was trying an example to have Enum as field argument but cannot get it work. I've looked into Graphene Enum documentation but it's not helpful. Here is the example code - https://paste.pythondiscord.com/idoyifimip.py
While executing the code, I'm getting following error -
data: {'errors': [{'message': 'Object of type EnumMeta is not JSON serializable'}]}
hi i need help
i need to get the total number of connected clients using flask-scoketio
i write this code
clients = []
socketio = SocketIO(app)
@socketio.on('connect', namespace='/test')
def connect():
clients.append(request.namespace)
@socketio.on('disconnect', namespace='/test')
def disconnect():
clients.remove(request.namespace)
then i render this
return render_template_string(TABLE_TEMPLATE, data=data, clients=len(clients))
in html part i display like this
<h1>{{ clients }} </h1>
but it keep showing 0 on web page even the client is connect it should be 1 2 depend how many client are connected
can someone help
Hi,
I am learning Django and how to handle API calls. I'm using https://rickandmortyapi.com/ Rick and Morty API to work with.
I'm building the characters page first. You can visit it here: https://rickandmortyapi.com/api/character/
I am able to make a call, get the response and display it on the webpage.
As every page has only 20 records, I want to have a link at the bottom of the first page to call https://rickandmortyapi.com/api/character/?page=2 this URL. The next and prev pages URLs are there in every API call so it is easy.
Now instead of displaying contents from an external API server, I want to render this next page onto my website. I have linked the above to an anchor tag in HTML and it is redirecting it to the external API as it should be. How can make a call to external API, and still render everything on my website?
if I used LoginView how to restrict the user to perform a specific task ?
@glad patrol pls ask ... if i can I will definitely help
thanak you for help
i have this problem
i need to display the number of connected clients on web page i am using flask-socketio and i write this code for checking connected and disconnected connections.
app = Flask(__name__)
socketio = SocketIO(app)
clients = []
@socketio.on('connect', namespace='/')
def connect():
clients.append(request.namespace)
@socketio.on('disconnect', namespace='/')
def disconnect():
clients.remove(request.namespace)```
then i render template like this
return render_template_string(TABLE_TEMPLATE, data=data, clients=len(clients))
In html part i call like this
<h1>{{ clients }} </h1>
but on webpage it keep showing 0 even client is connect i get output from client and it is connected it should print 1 2 depends how many clients are connected. even if i print this print(len(clients)) it return 0.
sorry bro ... I am kinda django user...
oh
if I used LoginView how to restrict the user to perform a specific task ?
@outer pier
LoginRequiredMixin.
This may help to authenticate if user is logged in or not.
@uneven radish thanq for your help...
is there any way to display image on django admin site
UserPassesTestMixin
Also check this. It enable you to check if user is performing certain actions on his/her created/modified items which are associated with his/her user ID.
is there any way to display image on django admin site
@outer pier I don't know about that.
definitely sir .... thank you for your valuable time
No problem.
any1 know flask
Im making a website with flask, but when I link the bootstrap stylesheet, it wont work
@glad patrol did you made sure your socket was connected
@glossy arrow what won't work?
@native tide Yeah, nvm I got it to work
is it the best practice to add image to django admin site or create a separate view to django staff admins so that they can verify the images from users ?
I am learning Flask with SQLite3 and following the Flaskr tutorial. How can I migrate my existing SQLite3 tables to SQLAlchemy?
I am trying to change column data type
@outer pier yes
how to pass down this.state from class to another class as a prop in a different file with react?
ping me up if anyone knows
Can anyone help me?
ya
So I'm wondering how to approach this. I have 2 different routes. Buyer and Seller. I want them both to have access to /dashboard. And /dashboard should either render seller-dashboard.html or buyer-dashboard.html based off their user role. However, I can't have two routes called /dashboard. How can I achieve this
but buyer/seller is two diff routes
I am using Blueprints
one for seller
one for buyer
buyer_bp.route
seller_bp.route
yh
I think I'm just going to use b/dashboard and s/dashboard to indicate which dash it is
because the issue is I don't have 1 routes file. I have 2 seperate, one for buyer and one for seller. So i need dashboard in each of them
have a third dashboard blueprint and redirect to that?
Which one is better flask_mail or flask_emails or no difference?
In Django is there a way to check if the user is an admin???
like you have {% if user.is_authenticated %} and LoginRequiredMixin
But for admin users
Is it the same
@twilit dagger There is. https://docs.djangoproject.com/en/3.1/ref/contrib/auth/#django.contrib.auth.models.User.is_superuser
i want to make my footer look like google homepage footer
but i dont know hoe to go about it to make it look like google homepage footer
Harsh Mangal, instead of Flask API, look into FastAPI
i need help regarding flask
is anyone familiar with proc files and uploading web applications to heroku with git?
i keep getting an error telling me that my procfile isnt working even though its in the right directory and I used multiple sources to figure out the format of said procfile
class MyForm(forms.Form): # stuff class Meta: widgets = { 'date_due': {'class': 'changed-class', 'type': 'date'} }This is the better method if you're not doing any special stuff in the
__init__method. @solar ridge
@versed python
I seem to get a AttributeError: 'dict' object has no attribute 'is_required' ?
Did you come across this as well?
Or does anyone else know how to modify the "type" attribute of a widget from the Form class?
Hey folks. I wanted to know is it possible to use Webpack with Django and Python? And how hard is it if that’s possible?
I've already read that documentation before which doesn't seem to work as expected. Following those guidlines I can set the date type, however if I visit the form from say an UpdateView which has prepopulated data from a model, then the date input does not retain that information, and instead shows a blank date input field
I'm starting to lean on the idea this is a bug in Django, setting the "type" attribute doesn't change a DateTime model input field. Overriding the input_type from the inherited TextInput widget (django\forms\widgets.py) changes the attribute, but does not populate the field with the original model data when in an update view
The only solution I have been able to make is using ```python
self.fields.get('date_due').widget = forms.TextInput(
attrs={'type': 'date'}
)
and that's inside the Form init
At some point between modifying the type input and rendering, the original value of the field is not converted.
@dreamy wadi 90% of the problems with Procfiles are with the directory
how do i make the left one same to the right one
this is my bottle framework and on the picture i started the localhost:8080 and i want it the same look as the right picture
@wanton ridge put the form inside a parent div then set the parent div's background image
so mean before the form i create a div and put the background inside?
Don't put the background inside put it as background-image in CSS
do u know how do i put my css in bottle? with the login.html?
But it's not possible to do without CSS
I haven't used Bottle a lot before
ok
Or you can just use inline-css
Hey guys. I wanted to know is it possible to use Webpack with Django and Python? And how hard is it if that’s possible?
Lets say I have two tables
class User():
id = db.column(db.Integer, primary_key=True)
task = db.column(db.String(20), nullable=False)
address = db.relationship('address')
class Address():
id = db.column(db.Integer, primary_key=True)
attempt = db.column(db.String(50), db.ForeignKey('user.task')
Now inside my route I pass through a query like:
return render_template('test.html', usr=User.query.filter_by(id=12).first())
Can I not access the address table because I setup up a relationship?
instead of having to also query the address table separately
@wet heath there's a package django-webpack or smth, that might help, I have seen it but never used it, you could give it a try
@bot.command()
async def lyrics(ctx, *, song):
driver = selenium.webdriver.Chrome("C:\Program Files (x86)\chromedriver.exe")
driver.get("https://genius.com/")
search_song = driver.find_element_by_name("q")
search_song.send_keys(song)
search_song.send_keys(Keys.RETURN)
search_lyrics = driver.find_element_by_class_name("mini_card")
this is my code
when i go to genius.com and search for a song it works fine but when i wanna get the element by class name called mini_card in top result section it gives an error that it cant find any element
there is a class like that tho (check out highlighted section)
try using beautifulsoup instead
selenium is only used for browser automation. If you use something like BeautifulSoup it will be less memory intensive
Hello everyone,
I have a Flask app that's running on Heroku. It currently uses Global variables to reference data across views and functions. I want to get rid of Global variables and use a database instead.
The data won't be stored permanently. It's only necessary while my web-app does its thing.
Do you have any tips on how to go about this? Should I just make a single database with all 34 Global variables?
did u try find_elements_by_class_name Arush?
yes
i did
i did by_class_name("mini_card")
but still got errors
<a ng-href="https://genius.com/Dj-snake-let-me-love-you-lyrics" class="mini_card" ng-class="{'mini_card--small': $ctrl.variants.small}" href="https://genius.com/Dj-snake-let-me-love-you-lyrics">
<div class="mini_card-thumbnail clipped_background_image--background_fill clipped_background_image" clipped-background-image=":: $ctrl.song.song_art_image_thumbnail_url" style="background-image: url("https://t2.genius.com/unsafe/93x93/https%3A%2F%2Fimages.genius.com%2F073cd0dbdf330c416680c3705d09270a.300x300x1.jpg");">
<!---->
</div>
<div class="mini_card-info">
<div class="mini_card-title_and_subtitle">
<div class="mini_card-title">Let Me Love You</div>
<div class="mini_card-subtitle">
DJ Snake<!---->
</div>
</div>
<!---->
<!----><div ng-if="!$ctrl.excerpt_with_markup">
<!----><div ng-if="$ctrl.song.lyrics_state === 'complete'" class="mini_card-metadata">
<!---->
<!---->
<!----><span ng-if=":: $ctrl.song.stats.pageviews">
<svg src="eye.svg" class="inline_icon inline_icon--up_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 15.45"><path d="M11 2c4 0 7.26 3.85 8.6 5.72-1.34 1.87-4.6 5.73-8.6 5.73S3.74 9.61 2.4 7.73C3.74 5.86 7 2 11 2m0-2C4.45 0 0 7.73 0 7.73s4.45 7.73 11 7.73 11-7.73 11-7.73S17.55 0 11 0z"></path><path d="M11 5a2.73 2.73 0 1 1-2.73 2.73A2.73 2.73 0 0 1 11 5m0-2a4.73 4.73 0 1 0 4.73 4.73A4.73 4.73 0 0 0 11 3z"></path></svg>
3.3M
</span><!---->
<!---->
</div><!---->
<!---->
<!---->
</div><!---->
</div>
</a>```
this is the html code of element i wanna access
u didnt do find_elements?
driver.find_elements_by_class_name("mini_card-info")
it should return a bunch of div's
@cyan hollow i defined that line with a variable called lyrics then when i did print(lyrics) it returned []
ok im not quite sure then
uh
I havent used selenium in a long time
oh
Best bet is to ask someone else in one of the help channels
(no one answers)
try googling it then
Do you have any tips on how to go about this? Should I just make a single database with all 34 Global variables?
@nova crest use redis, maybe. In-memory key-value store, would be faster than a full-fledged DB like SQL.
@lethal orbit Interesting. Do you know where I can find documentation or a tutorial on Redis?
I've been googling it, but I'm not sure what I should be looking for
https://university.redislabs.com/ is good. The docs are pretty good.
Hi All,
Django related question.
I am making a call to an API, fetching the data and displaying it on the webpage.
Should I directly display it or fill it in database and display from my model?
What is more optimum way of doing this?
oh, that looks fancy!
I first read about it in 7 databases in 7 weeks
Not sure if you can do their course in a day instead of 6 weeks lol
Also, #databases is a good place to ask questions
oh right, thanks!
@cunning falcon What is your final goal here? What are you trying to build?
It's great. Doesn't go into details much, but it spends 3 days on each DB explaining the basics.
so at the end, i'll be able to walk away with information about where to use each kind of database 🤔?
Yeah. Gives a decent overview.
@cunning falcon What is your final goal here? What are you trying to build?
@uneven radish when i search for a song there at that website, in top result there is a box, so when i inspect it, i get class_name as mini_card so when i try accessing that element by clicking it, it get error that there's no element with that class
Introduces you to Graph Databases, NoSQL, etc.
(Probably better to discuss in #databases also lol)
yeah alright
@cunning falcon Can you send me the link please, I'll look into it.
You are clicking the top result?
This one?
This is Top Result right?
yes
Okay.
@uneven radish so how to fix the prob?
I'm checking.
ok
Have you tried get_element_by_class_name? And extracted its a href?
when i do get_ele_by_class_name i get error that no class found
@uneven radish u here?
@cunning falcon dude you need songs = soup.find_all('div', class_='mini_card-info')
now then even so your going to need to identify the sections ng-repeat="section in $ctrl.sections"
I'm trying to use flask restful to make it so that I can do a GET request, how do I get the url parameters?
This is where its broken up into top results, songs, lyrics @cunning falcon
google gave me so many different answers I decided to ask here
then your going to need to loop through those sections and if the section title is not songs then continue
@haughty turtle im not using beautifulsoup!
then what are you using.
songs = driver.find_element_by_xpath("//div[@class='mini_card-info']")
ok
and stop pinging people multiple times if they dont answer their busy its annoying.
Have you followed any tuts
yes
tech with tim
i just followed the basics
@haughty turtle how to extract href from it?
check if that class is clickable
how to check?
by trying to click it.
Is this even a selenium help channel. Do not see how this is web-development related
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class='mini_card-info']"}
i cant even go to that element
@haughty turtle
open a help channel and ping me
ok
this is taking to much space here.
k
ay guys, i cant find information on how to use OrderingFilter from django rest framework inside ModelViewSet @visual pivottion, does anyone know how would i implement that?
@glacial night you just have to import (from rest_framework.filters import OrderingFilter) and add these 2 variables in the class based view
filter_backends = [OrderingFilter]
ordering = ['column name']
@glacial night where are you getting ModelViewSet from?
basically inheriting the class right ?
so its a class based view
decorators ? they dont work on classes
can you post your code here
oh ok i thought you were directly trying to order the viewset output, not sure about this though
@glacial night how about adding the ordering in the product serializer itself ?
@glacial night should it be dynamic or always ordered by a particular columns ?
In my Flask app, I have multiple global list variables, such as:
location = ['address 1', 'address 2', etc]
appointmentTime = ['time 1', 'time 2', ect]
The values in the list are user-specific.
I want to replace these global variables with a database. Is it possible to put these list variables in one database?
So, I'd have 1 column for user_id, a column for location and a column for appointmentTime.
oops, wrong channel
@glacial night sorry not sure about how to do that
i would like to try this hacky solution, order the query set with .order_by('column_name'). replace the column_name string from the request data 😅
why do i get an error:404 not found
which framework should I choose for serious webapp backend devlopment which can handle heavy traffic as if i will be building backend for facebook , netflix etc?
Django(python) or Express(Nodejs) or somthing else
Hello guys, I want to know which module should I see to build an API with Flask, Flask Restful or Flask RestPlus
@glacial night i changed to this but still doesn't work
i wanna get the html code to bottle and after i starte the server in localhost it should be there my html code
also the html is in the same file
@glacial night What do yo u think about the MERN stack ? recently i am getting attracted towards it.
py pipenv install flask flask-sqlalchemy flask-cors when i type this into cmd it doesnt work, and ideas why?
so u use the R with Django ?
hi i need help
@hidden mantle did you try without "py"?
@glacial night yeah
how to get total number of connected clients in flask
then it says that it coudnt fint the command pipenv
@glacial night how to get total client conencted to flask app
like this is my code
no no
import requests
import subprocess, string, time
import os
url = 'http://127.0.0.1:5000/'
name = os.uname()[1]
def on_device_add():
requests.post(f'{url}/device_add?name={name}')
def on_device_remove():
requests.post(f'{url}/device_remove?name={name}')
def detect_device(previous):
total = subprocess.run('lsblk | grep disk | wc -l', shell=True, stdout=subprocess.PIPE).stdout
time.sleep(3)
# if condition if new device add
if total > previous:
on_device_add()
# if no new device add or remove
elif total == previous:
detect_device(previous)
# if device remove
else:
on_device_remove()
# Infinite loop to keep client running.
while True:
detect_device(subprocess.run(' lsblk | grep disk | wc -l', shell=True , stdout=subprocess.PIPE).stdout)
this is my client side code
when i run my flask app
then i run this client code
which display if client connect usb or not
i need to get this how many clients are running
this is my basic flask app
from flask import Flask, request, render_template_string
app = Flask(__name__)
TABLE_TEMPLATE = """
<style>
table, th, td {
border: 1px solid black;
}
</style>
<table style="width: 100%">
<thead>
<th>Client</th>
<th>IP</th>
<th>Status</th>
</thead>
<tbody>
{% for row in data %}
<tr>
<td><center>{{ row.client }}</td></center>
<td><center>{{ row.ip }}</td></center>
<td><center>{{ row.status }}</td></center>
</tr>
{% endfor %}
</tbody>
</table>
"""
@app.route("/device_add", methods=['POST'])
def device_add():
name = request.args.get('name')
with open('logs.log', 'a') as f:
f.write(f'{name} Connected USB from IP: {request.remote_addr} \n')
return 'ok'
@app.route("/device_remove", methods=['POST'])
def device_remove():
name = request.args.get('name')
with open('logs.log', 'a') as f:
f.write(f'{name} Disconnected USB from IP: {request.remote_addr}\n')
return 'ok'
@app.route("/", methods=['GET'])
def device_list():
keys = ['client', 'ip', 'status']
data = []
with open('logs.log', 'r') as f:
for line in f:
row = line.split()
data.append(dict(zip(keys, [row[0], row[-1], row[1]])))
return render_template_string(TABLE_TEMPLATE, data=data)
if __name__ == "__main__":
app.run(app, threaded=True)```
so on this flask app i need to display how many clients are running right now
not this how much views
not viewing page
see first i run my flask app
ok
then i run client code means 1 client connect to my appp
and it keep sending info
if i stop client code then 0 client is connected
i guess some counter stuff work but idk where to put it
yes i try flask-scoketio but it display views
https://prnt.sc/utjogf im following a tutorial but the text i get is something diffent form the on in the tut
it is exactly the same code
@native tide just posted about https://brython.info/ in general, wanting to know if anyone has used it, seems interesting, a python replacement of javascript
Brython
can someone help me with this
@mortal sentinel fix yourjsonfile.
how ?
okay
I was looking at brython a little more closely @haughty turtle
It relies on a Javascript library, brython.min.js so to be honest I'm skeptical that its a realistic solution. That being said, if they advance it, it cant be any more insane than any of the rest of the front end frameworks. But it cant be actual python.
If anyone has more experience than the last 30 minutes of me looking at it, Im interested as well.
I'm running a uvicorn api, on local host it works perfectly yet when I try to connect to it it doesn't work, port forwarding is enabled
Yeah I mean as it's not massly adopted I imagine they have to build it on top of js in the meantime @native tide
But has potential
I'm interested in knowing if its using an actual python interpretter. But I havent had time to investigate it a lot. I think its a cool idea though as well.
I do recall that at one point gdude said to someone asking if client side python was possible, something to the effect of... 'Technically yes, but its not a good idea'
I didnt understand what he meant then, but he might know more. I imagine this is what he was talking about
i want to start a django app within my django project but it is giving me an error as i type the code in vsc builtin terminal which is phyton manage.py startapp name
phyton : The term 'phyton' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- phyton manage.py startapp blog
- ~~
- CategoryInfo : ObjectNotFound: (phyton:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
this is the error
spell it python
it happens 😛
try to to cd C:\path\to\project and then try again
im not super good at Windows command line but it sounds like you're not in the right folder.
i mean my project is in this directory
so we cannot have app here
it is not making sense
Django project structure is the most confusing thing about django.
If you have not done it yet i recommend doing the practice polls app on their documentation
and also cannot understand properly the c directory thing u told
Because it explains the confusing waay of it.
No, Im afraaid i do not have time for that. Sorry.
np
i mean most confusing thing about frameworks is starting a project but it is a one time effort
If you dont learn the very strict project structure it only gets worse as it gets bigger.
@obtuse kite are you on windows
Things should be very exactly where they go and its not intuitive.
@obtuse kite are you on windows
@stable kite yes sir
If you dont learn the very strict project structure it only gets worse as it gets bigger.
@native tide that's why i stopped my tutrioal and learning it first
just i have to type Is without any suffix or preffix sorry if it get u annoyed
it is just ls
LS but small
you dont have to type any suffix or prefix
[projectname]/
├── [projectname]/
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── manage.py
Its confusing becaause if you're following the default structure you will have something like this
you have a project folder inside of a project folder
You have to be in the outer project folder
The reason why it is like this is easier for you to just read
But its confusing at first
Directory: E:\phyton programming
Mode LastWriteTime Length Name
d----- 05/10/2020 21:01 hypernovaa
d----- 22/09/2020 22:40 Project Hypernova
-a---- 11/09/2020 01:08 381 Classes and instances.py
-a---- 11/09/2020 00:46 79 ok.py
-a---- 01/09/2020 00:32 81 super.py
-a---- 29/08/2020 16:42 406 test.py
it gives me this
hypernova is the name of django project
no problem
yeah the cd means "change directory"
yes
cd makes u kind of enter like open a folder
am i right?
this is the stuff u learn with time
I am not too old
just 2 months
ya somewhat yes it allows you to access the stuff inside the folder in terminal
yeah Django is pretty hard as a first project so dont get upset if it seems like a lot when you get into it
Where is the cgibin in apache2 running on raspberry pi 4?
@native tide yeah I imagine so, as it's client sided it would have to have built in functionality with all major browsers
Eh still diving into JS now but I imagine this is what the problem would be
Lets say I have two tables
class User():
id = db.column(db.Integer, primary_key=True)
task = db.column(db.String(20), nullable=False)
address = db.relationship('address')
class Address():
id = db.column(db.Integer, primary_key=True)
attempt = db.column(db.String(50), db.ForeignKey('user.task')
Now inside my route I pass through a query like:
return render_template('test.html', usr=User.query.filter_by(id=12).first())
Can I not access the address table because I setup up a relationship?
what is your error @past cipher ?
Pssh JS is si simple, similar to Python I mean once you know python you can learn any language easily
Do you know C?
JS might be simple, but the syntax is awful.
Can anyone here help me out on #help-carrot it's about django rest api
has anyone integrated python social auth with Shibboleth?
I assume it should work with any SAML IdP
Hi friendly people, I have a Django website that has a different name locally than on my server. Thus far, any time I have done recursive copies of the entire website onto the server, I have gone into the files and changed all references to the name by hand, but this is pretty tedious. I could write a script to do this, but that might take a little time to get right. Does anyone know of any pre-built tools to recursively search through all the files in a directory and replace a string (or substring) with another pattern?
can someone help me in #help-pancakes
I dont know how to add extra data to post requests
apart from the value
Hey! I have a begginer question about Django. I think the easier for me to explain it is to show my code, here's what I got in my urls.py:
path('<slug:slug>/', views.LanguageDetailView.as_view(), name='languagedetail'),
path('<slug:slug>/', views.DomainDetailView.as_view(), name='domaindetail'),
And in my Views:
class LanguageDetailView(generic.DetailView):
model = Language
slug_field = 'slug'
class DomainDetailView(generic.DetailView):
model = Domain
slug_field = 'slug'
So the idea is that if it doesn't find any Language model with that slug, instead of showing a 404 error it searches a Domain model with that slug and show it (and then if it doesn't find one, throw a 404). Obviously right now it doesn't work for the second part, if it doesn't find a Language it throws a 404 error withour searching for a Domain. I would like to know what is the cleanest and better way of doing it. (I tried to do that by overwriting the get method in LanguageDetailView but that didn't work well and doesn't seem to be a clean way of doing it at all)
Hi everyone! New user here! Quick question that I don't need a whole channel for: are there any free (or very cheap) hosts that allow me to deploy flask working on postgresql?
Hey Guys im trying to build a basic python program that gathers information from instagram using the JSON data from instagram. the data right now tho is a bit hard to read. do any of you guys know any way to make the JSON data more readable? The link i am using is: https://www.instagram.com/account_name/?__a=1 where "account_name" is the profile i am scraping.
You mean human-readable? I use the JSON Formatter chrome extension for that and it does a wonderful job at beautifing json files
@wicked axle
👋
good afternoon
good night, my friend
is this the right chat to ask about django and flask?
great, thank you very much 🙂
I already made my question, for now I don't have more questions yet
but I will ask again soon, because I'm interested in django and flask
haha good luck, feel free to drop by
well, now I have a question
ok
@ionic rover DigitalOcean
does anybody know good book that teaches flask with python 3?
$5 for a basic box/server.
@bronze blaze Have you looked at the basic tutorials online?
They're usually quite comprehensive.
I know more of the Django sources, but I'm sure Flask has many of them as well.
all right, I'll try the tutorial method
Hello, anyone here use django-notifications package before? I am trying to find a good way to mark my notifications read but not sure what a good approach would be.
@devout coral If you're comfortable doing it, I just made a simple ajax function that will refresh the events on the page with html/css that updates accordingly.
I'm not sure what the package does, but it was not a lot of work to get a notification system going.
And this way I had total control over it.
So question, would it be smart to just set all notifications to read as soon as I click the notifications button?
That depends what you want to achieve.
If you want them to read each item, make it per item. If you just want something like FB where it disappears after they open their notification window/drop-down, then sure.
I want to make it per item but how would I set it to read as soon as they click it? Every notification is basically a url to go to what happened. I was thinking of just adding it to the body of the url but then I would need the id of the notification when creating the notification.
Not sure if I made sense.
You can make the view of that event page set the event to read.
So when the event page loads, it changes its status.
Correct. That is what I was going to do, but how would it know which notification it clicked. Since this "event" page could be the same url for multiple notifications
You can send the event_id with the URL when they click it, load that object upon loading the view and if not read, mark it as read. Something like that?
I was thinking of passing the notification ID in the url to use in the view but I cannot put the id in the URL while creating the notification.
Why not?
Oh wait.... I am dumb.
Just ignore me. Trying to do everything in one line when I do not have to.
The struggle is real.
Yeah
Either way we got you where you needed to go!
@dense slate Thanks, got it working
Sweet deal.
Just a little freebie for anyone here -- I had a problem with a Django website where the name of the project has to be different on my local computer and server, so I wrote a script that goes through the entire directory and changes any reference to the project name both within file contents and in the names of the files and directories. I'm sure there are other programs that do this, too, and probably better, but I have tested this, and it seems to work, so I'm pasting the code for anyone interested in using it.
This works for any string/substring you want to replace anywhere within a directory with another string/substring. You can also include sub directories you want to exclude as long as it only requires the name (and not the full path) of the directory for specificity. You can see I excluded my virtual environment since it is a large, irrelevant directory, which would slow down the program. You can also choose which kinds of file extensions to check for since the string you're hunting for may only be in certain kinds of files.
import os, re, subprocess
# Target string and new string with which to replace it
target_string = 'local_site'
new_string = 'server_site'
# The root directory to make the changes to
target_dir = '/home/path/to/directory/containing/website'
# File types to check within for target string
file_types = {'js', 'css', 'html', 'py',}
# Subdirectories to exclude from search
exclude_dirs = {'venv',}
types_re = '('
for i, ftype in enumerate(file_types):
if i < len(file_types) - 1:
types_re += '\.' + ftype + '|'
else:
types_re += '\.' + ftype + ')$'
rel_dirs = []
rel_files = []
for root, dirs, files in os.walk(target_dir):
dirs[:] = [d for d in dirs if d not in exclude_dirs]
for d in dirs:
if target_string in d:
rel_dirs.append(os.path.join(root, d))
for file in files:
if re.search(types_re, file):
rel_files.append(os.path.join(root, file))
# Go into each file and check for and change target string
for file in rel_files:
with open(file) as read_file:
new_file = read_file.readlines()
with open(file, 'w') as write_file:
for line in new_file:
if target_string in line:
line = line.replace(target_string, new_string)
write_file.write(line)
# Change any relevant file names
for file in rel_files:
new_file = '/'.join(file.split('/')[:-1]) + '/' + file.split('/')[-1].replace(target_string, new_string)
file_cmd = subprocess.run('mv '+ file +' '+ new_file, shell=True, capture_output=True) #Command for Unix-based systems
# Put lowest directories first to avoid issues changing names
rel_dirs.sort(reverse=True)
# Change directory names
for rd in rel_dirs:
new_dir = '/'.join(rd.split('/')[:-1]) + '/' + rd.split('/')[-1].replace(target_string, new_string)
dir_cmd = subprocess.run('mv '+ rd +' '+ new_dir, shell=True, capture_output=True) #Command for Unix-based systems
Note: If you use this code, the commands (the first argument of subprocess.run) denoted by the comments will only work on Unix-based systems. You will need to use a different command if you are on Windows.
Is it possible to make the /admin site a login site for the admin user in flask? without making another template? and it only works for the admin?
if any experienced flask users could answer a could of questions in DM, i would really appricate it 😄
@lean rapids I don't know Flask, but I know Django, and it's definitely possible. What do you mean by make it a login site? Have a link on the home page? Redirect to the admin page if the user is an admin? Even though I don't know Flask, I'm sure both are possible.
@topaz widget So basicly, if i type in "something.com/admin" it sends me over to the admin page. (logged in)
but i dont want to be logged in, i want this site secured
do I need another template for this? which redirects me?
@topaz widget So basicly, if i type in "something.com/admin" it sends me over to the admin page. (logged in)
but i dont want to be logged in, i want this site secured
@lean rapids so you're saying you only want to be able to access it as an admin?
I didn't realize that was the default in flask. I'm sure you can change that.
yes @vestal hound
In Django, attempting to access the admin page will just give you a login screen unless you are logged in as an admin.
ohh, in flask i can only type /admin and im in , no need for login
but i kinda want to login, so noone else can just type in /admin and they can do whatever they want
Well, I'm sure there's a way to require user authentication to access certain pages or content. There's no way that's not a feature of Flask.
Maybe i have to make another template, but i was hoping i didnt have to :/
No, I doubt it has anything to do with templates. It mostly likely has to do with your views.
(python files)
I mean, you could probably handle it in the template, but I don't think that would be the best way to do it.
The best way would be to put that logic in the view and then return a different template depending on whether the user was logged in as an admin or not.
Read a lot about this func "is_accessible" which is suppose to do it, but i cant make it work, seem hundreds of tutorials but they kinda seem outdated, because they dont work 😦
Well, I don't know Flask so I can't tell you specifics, but I'm sure there is a way to do it that isn't too difficult. That's just too big a requirement for a lot of websites
ohhok,then im guessing i would have to make roles? (user or admin roles)
Maybe. Django has those natively, but you might have to create that yourself in Flask.
ohhok, well.. thankyou so much! 😄 I will probably have to go back to my googling/tutorial researching , there must be something , just cant seem to find it 😛
Yeah, the solution is definitely out there. Good luck!
Thanks 😄
If you're going to be doing complicated authentication stuff, you can always make the switch to Django, too. Django has a reputation for being better than Flask with more advanced stuff.
ohhh, my friend which is kinda experience(i think) in django, told me flask is easier (?) and sometimes better
From what I hear Flask is easier to get started with, but Django supports more advanced stuff better.
Steeper learning curve with Django but ultimately more powerful.
hey, stupid question, but is there some way to make google list the top navigation links like in this example:
something like manifest or sitemap?
view-source:https://www.th-koeln.de does not hold any relevant meta tags
they didnt even include a description or keywords
Let me take a look
there must be either some file i think or google does it itself and you cannot influence it
Well, then it probably has to do with how they index the pages.
@native tide Sure, yeah it seems like it's probably how their algorithm ranks the pages
Small question but if I have a user logged in and I want to have the username at the top corner, do I have to push request username to the html?
@plucky tapir in django templates, the current user is accessible by {{ user }}. So in your case, you can do {{ user.username}}
Guys, why do I do a search and do the paging of this search occurs this error?
@jolly elm ???????????????????????????????????????????????????????????
what's the error?
this
code please
okey
not the entire code, just the part which is raising the error
If I'm in a users app area, and I want to return to the base main page, what would I redirect to?
return redirect(request, '/')
Is what I thought but getting stuck
users/url.py
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('register/', views.register, name='register'),
path('login/', views.login_, name='login'),
path('signup/', views.signup_, name='signup'),
path('landing/', views.landingpage, name='landing'),
path('logout/', views.logout_, name='logout'),
]```
main urls.py
``` from django.contrib import admin
from django.urls import path, include
from . import views
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.home, name='home'),
path('users/', include('users.urls')),
path('users/register/', include('users.urls')),
path('users/login/', include('users.urls')),
path('users/signup/', include('users.urls')),
path('users/landing/', include('users.urls')),
path('users/logout/', include('users.urls'))
]
@plucky tapir return redirect(reverse('index'))
@jolly elm you need to explain your problem a bit more
@versed python When I perform a search and paging the results of that search causes the above error
TypeError at /search/
object of type 'NoneType' has no len()
@jolly elm what are you subclassing your view from?
afaik, super().get_queryset() will not yield anything by default
can you add a print(result) after super().get_queryset?
where @jolly elm is using len function in his code @versed python
I think one of Django's filter functions uses len. As you can see from the screenshot, the error is raised inside the django source code
no i don't think so that Django's filter method uses len function
I think one of Django's filter functions uses
len. As you can see from the screenshot, the error is raised inside the django source code
@versed python yes
it obviously does, since the error is being raised. Unless they posted the incorrect traceback/code @stable kite
@jolly elm can you share the log of the server
@jolly elm can you share the log of the server
@stable kite I don't know where that is.
it is in the terminal from where you type python manage.py runserver
okey
why do split your query variable
This is the log?
why do split your query variable
@stable kite My teacher said it was like this
you need to pass a argument to it
in this way you can split it
your spiliting is wrong
yes this is the log
share a screenshot of upper part of log
it depends on what query is. If it's whitespace separated, idts that's the issue
I am just getting into front end development and plan to just use sockets. I know how to feed raw html code into a response but is there any libraries to use the root directory of my TCP server for html and image files instead of hardcoding html?
If not I could probably just use os and read the files
i am going to genius.com to get lyrics of a song, so when going to lyrics page, in their souce `html code, i see multiple elements so which element should i access to get the whole lyrics?
@native tide I don't think sockets are really relevant to front-end development.
https://genius.com/Dj-snake-let-me-love-you-lyrics take this as reference (example) in this i want to access the text of all the verses and choruses
You're talking about back-end stuff by the way @native tide
with the exception of HTML, which is front-end.
@cunning falcon Access all the elements that contain lyrics.
i was thinking about that only but its a command (so different song's lyrics) so different songs have different verses and all so elements are not the same in every song
its not possible..
It's definitely possible.
how
I have question about django how we determine we need to make how many apps for any project
There is a pattern to the website and therefore it's possible.
On which basis we create apps
im new to selenium
There is a pattern to the website and therefore it's possible.
@topaz widget can you tell me how?
What are you planning to use this for?
async def lyrics(ctx, *, song):
driver = selenium.webdriver.Chrome("C:\Program Files (x86)\chromedriver.exe")
driver.get("https://genius.com/")
search_song = driver.find_element_by_name("q")
search_song.send_keys(song)
search_song.send_keys(Keys.RETURN)
prev_url = driver.current_url
while True:
if driver.current_url != prev_url:
print(driver.current_url)
break
search_lyrics = driver.find_element_by_css_selector("a.mini_card").get_attribute("href")
driver.close()
driver.get(search_lyrics)```
a lyrics command
at last piece of code, i get to the page where lyrics is
@cunning falcon All the elements that contain lyrics have the class "referent" and it looks like "referent--yellow", too. I would start there.
I know I'm using my own backend so I don't have to server host like this book suggests me to do
@cunning falcon All the elements that contain lyrics have the class "referent" and it looks like "referent--yellow", too. I would start there.
@topaz widget so what should i do?
find elements by class name
So if I could have my backend handle what the server host would it'd be good for learning
should i do find_ele_by_class_name("referent")
then print(element.text)?
I don't know, I haven't used Selenium in a while. But using the class name is probably the way to go. If that doesn't work, those elements have all kinds of attributes you could use to find a pattern with.
You don't know what a pattern is? What's your native language?
hindi
But you learned English growing up, right? Don't most people in India learn English from a young age?
Do you not know what a pattern is?
im not talkin about that pattern
i know that pattern what you are talking about
but idk how do i implement that in my code
Code is all about finding patterns. If you don't know how to find patterns and write code to capture those patterns, I don't know how to help you.
I would just be doing your work for you. You have to find the patterns or see them, but I can steer you in the right direction.
@native tide I'm not sure what you're asking, and, to be honest, I think you need to do a lot of reading about basic web development concepts.
Confusing front-end and back-end tells me there are some pretty critical gaps in your knowledge.
wait isn't html front end?
yes but everything else you said wasn't.
Maybe the failing in my part isn't knowing enough of what I want to do
So are you trying to set up an http server then?
If all you're trying to do is build some web pages and link them together, you can do that with http.server
Is that what you're trying to do?
If you're actually trying to build a website, you need to do a lot more than that.
I don't want to host it on the www I just want to use localhost to see webpages I make
And it'd probably make my life a lot easier in the future if I read the front end code off of files rather than hardcoding it into my server file
I'll check out http.server
http.server is really helpful and it can serve your HTML code off your current (or specified) directory.
Basically it spins up a webserver on your local machine and the static pages (including JS & CSS) are hosted off the server. You won't be needing any sockets/os module for doing the same.
Anyone tried DRF with Flutter
Thank you I appreciate it this looks like what I needed
Again, I waded into DRF briefly.
Django rest framework is awesone
Don't want to try and make something that already has a library
@native tide If all you want is a local http server for the time being, just use the following command in the directory containing your root webpage (often index.html):
python3 -m http.server 8000
Do you know how to use the command line?
Oh on god? That's pretty sweet
Much easier than using a socket
Yeah I know command line
Yeah python has lot of potential
Okay, also... you can use any number that is an available port after http.server, 8000 is just a typical one to use for localhost @native tide
I usually used 8080 I know it isn't that important which
That would work fine.
port are just for yourself
But if you have multiple directories open at the same time you want to run at the same time, you can use different port numbers.
I used something like 10 to 15 ports per day
I used sockets on using a esp32 as a server so I was going off that
Yeah, http.server takes care of all of that. It just turns your file directories into http protocol.
Yeah @topaz widget
I like Python very much.... But don't from where Javascript evil has came
Bro Javascript is trash use typescript instead
I used javascript for react js..... Angular is more good
It uses typescript
Now I also don't have to use React Native
because Another King is there
Another King?
The Js stdlib has greatly improved
JS is trash....
I know three to five languages for which I can make everything that I want
yeah typescript is just a big footgun protector
I don't know any js yet
Yeah If typescript was not there I will never loot at javascript world
Read Eloquent JS, it's a good book and there's a free online version.
I was very much impressed by typescript
Free online books sign me up
@tepid lark I know JS very well.... After that I did breakup with it
You can make everything in just one language
@native tide If you want to do front-end web development, you should probably learn JS
Don't listen to him.
I mean use TS
Yeah'
I got a book on php, html/css, and js
TS >>>>>>>>>>>> JS
php is that a joke
You can python and django which has async also
@native tide If you want to do front-end web development, you should probably learn JS
@topaz widget you can use TS for everything you can use JS for
nothing easier than enabling mod php on apache and throwing up some php
Php's name acronym makes me happy
Php's name acronym makes me happy
@native tide it does though, doesn't it
PHP is old tech
PHP 7 and 8 are/will be quite nice to work with
But why not just learn JS to start out with?
hm
And then just extend your knowledge with TS
Learn TS bro
I think it's the other way round
From what I understand, TS is a superset of JS
No TS is a superset of JS
it is
so learning JS won't hurt you in learning TS.
superset means you don't have to learn JS
I like to start with building things and then delving deeper into those things
You can directly jump into TS
so learning JS won't hurt you in learning TS.
@topaz widget but there are things you should do from the beginning if you're planning to use TS
in particular, typing.
there's some tooling but tsc isnt hard
like you can write Python without type hints
@vestal hound Such as?
type hinting, more or less
hence the type
and because you are going to type your functions and stuff
Yeah... If you trying to debug js... It's very hard
it would be better if you wrote your interfaces and types from the start
since they need to be defined separately
good for you
There's many ways to skin a cat I feel
Okay, do what they say and learn TypeScript then @native tide
TS bindings are great when you have some thirdy party lib
I mean
Yeah... You can easily debug TS
They seem to know more about TS than me, so I will defer to their judgment.
you don't have to unless you're going to use Angular, at which point I think it really makes sense
But dart also amazed me
and I am a firm believer in the value of typing
in FLutter
in particular, when you use languages with very powerful type systems
you see their value in detecting errors at compile-time
@vestal hound did you mean Java
however, if you're still experimenting and you just wanna play around a little...
@vestal hound did you mean Java
@viscid roost no.
Java's type system is not powerful.
I don't know how far I plan on going with web development but it'd be a good way of furthering my knowledge in computer science in general
Hi all
hello there
Hi
If it might help me in the long run and net me a career someday I add it to the list
Well, you should either learn TypeScript or JavaScript if you plan on doing front-end development unless you want a potato website.
They seem to know more about TS than me, so I will defer to their judgment.
@topaz widget do you type hint your Python code?
Whats the best way to go from nodejs to Flask?
no JS, only HTML
and which one is better just curious
@vestal hound No. should I?
If you want to be web dev
BACKEND => DRF, DATABASES
FRONTEND => VUE, ANGULAR
ah, that's probably why
I need to get good at databases
@vestal hound No. should I?
@topaz widget do you use any statically typed languages?
I try to keep all my variable names as unique as possible.
Not really, no @vestal hound
Postgres is great
Mongodb is great
you can detect a lot of errors at compile time
Postgres seems nice
if you use a language with a sufficiently powerful type system
MongoDB is also great
because the compiler can prove that those errors can occur, given certain input
and alert you accordingly.
If I can get it to work on my shitty chromebook massive brownie points
type hinting is a way of bringing some of those benefits to dynamically typed languages
Because mysql was not having it
like Python and JS
look user don't care in which tools you made the product they only cares in look and performance
whats the best way to learn Flask coming from a nodejs background
you can use JS instead of TS, just like you can use Python without type hints
No love for SQL Server huh
and in cases of small throwaway scripts it probably won't matter
but as your codebase increases in size, maintainability is markedly increased by proper typing
@vestal hound Maybe I don't know what I'm missing, but I feel like I've been able to debug fine with dynamic typing.
really?
FastAPI is great
Flask is great for small projects
I don't like node
What sort of app are you making?
I like Django rest framework
just like a small non profit project
its asynchronous ability gives it power with security
so node good flask bad?
damn
but you need many other parts
well node isn't a web framework
to build a fully-featured backend API
Don't get too comfortable with Django, though.
^
I wouldn't say Flask is bad but when you're dealing with big projects, you tend to outgrow the framework
I worked with Flask I agree it is a pain in the neck
comparing Node to Django is pretty weird
I've found Flask is really easy for my use cases
Its security at least. Django's default authentication system leaves a bit to be desired.
ahhh I see
You can use any database in Django.... without writing in SQL
For small projects flask is probably neat
Node has security issues
@viscid roost like what
I use SAML so support is universally spotty
You can use any database in Django.... without writing in SQL
@viscid roost Django's is not the only ORM available
well use it for authn
But for complex tasks I see flask just not doing it
Node don't have built in auth
@viscid roost Yeah, Django's ORM has been pretty decent in my experience.
Python doesn't either lol
it don't have hashing
okay so I should start with flask and if it gets big, I should move to smth else like Django?
Django
@viscid roost Django is not Node
Just use Django
Django is great for crud apps
@viscid roost Yeah, node or express's lack of built-in auth led me to abandon it back to Django.
why are you comparing a runtime environment to a backend framework
You'll be fighting with django if you're doing things outside the box
you might as well say Play > Python
Node used to have security issues in terms of packages and on who published the packages but I think it's now fixed as NPM is also having checks from their end
Because we are taking about backend
okay, I primarily use it with DRF
Yeah correct
but fair, it is a web framework out of the box
Node would express or sails
@native tide Probably not a bad thing to learn if you already know Python.
What do you use with DRF?
Well you will never make a website with Django..... Use DRF + some frontend framework
I assume some front-end framework but I missed the thread.
If you're doing some small nonprofit site the best one is the one that lets you get shit done
Yeah me too
but it's up to you
Have you ever used Vue @vestal hound
nope
Would you like to?
My tech stack is .... Flutter + DRF + Java + angular
Vue is neat, nicer to learn than react
I wouldn't mind trying it out for a hobby project
React is fucl
For caffeine
Java for Native Android Dev
the strength of the ecosystem, and the power of the JVM
AAAA
a wise choice
@tepid lark Yeah, I liked Vue better when I was shopping around for a front-end framework to dig my teeth into.
kotlin syntax makes my head hurt
Kotlin is new official language for Android
Google is moving Java out of the frame now
sometimes, Java sucks for the JVM part as when you're having complex requirements (say media streaming) and when you're trying to get the most out of your server then the same thing bites you back and you generally find yourself meddling with the JVM settings
This is something which I faced.
