#web-development
2 messages Β· Page 44 of 1
I was just curious. If its private, no problemπ
It is kind of an account shop but not exactly
i only used xd
It is free. But I had issues downloading it
Xd is used only for quick propotype right?
@native tide Adobe XD u mean?
@toxic marten Not really, you can export HQ SVGs from there
So u mean i can create front end using a drop&drop
Not entirely
But basically yea
You then have to find a way to make it work backend-ly
But I wouldn't suggest using sich software, building a website with bootstrap is easier sometimes than getting in the process of making it on adobe
I downloaded it because one day i think it could be useful, for prototyping
Yes me too
Coding is better
I use bootstrap for front end
I dont rly do frotnend
Although I am surprisingly good at it
Do someone know some software for front-end prototyping?
i am currently getting good at frontend
yes i mean adobe xd
having a lot of issues downloading it
I downloaded it but i never used at the moment. I use bootstrap, but when i have to think about the project (how to set the website) i use paper and pen
nooo it crashπ«
Does anyone know how to add link to local element
What do you mean
sec
@native tide yes it is free, downloading wasn't a problem at all
I have made this that scrolls you backup when you are at the end
Is there a way I can do that for an element with smooth scorlling
scrolling
Basically user clicks a button called login and it scrolls him down to the login form
i think with javascript yeh
while true (window.fullheight) -=1;
idkπ
with an ease-in-out animation added
very nice
@native tide im reading what is adobe xd on adobes website. I dont understand if it produced with the idea of do prototype or do real website
heh
what did you think though
it's for prototypes
and i think it works better than pen and paper. I've tried using pen and paper before

you can add animations and such
π
hey guys, is someone here who can help me with picking a webframework :) / helping me choose if to use a web framework or a game building framework
What are you trying to accomplish?
In any case
I also have a question.
In Django, I have used user.is_authenticated to remove and show the register/login links based on a login session. But a user can still manually enter those urls and bring up the forms while logged in. I am familiar with the login_required decorator but im wondering if there is an option for opposite
I could have a conditional display of content on the templates for login/register and a redirect or something.
But I imagine someone has thought of a better way
@native tide check if user is not authenticated
I do that too, but with DRF
so I have a permission that checks if the user is not logged in
I'm not really familiar with what DRF is. In fact the first time I heard of it and searched was earlier today. I only sort of know what REST means. My impression is that it has something to do with the idea that... front end rendering takes a load off the server or some nonsense? Am I way offbase because I am just guessing.
I know how to do an {% if not user.is_authenticated %} but thats not the same as the @login_required decorator which just makes it impossible to open the page until you login.
Let me look at what happens on other websites if I try to do this.
It would be cool if there was a similar decorator to just redirect away from that page if logged in.
But you know I could put the condition directly in the view as opposed to the template
that would make a lot more sense lol
ty
okay, basically
by default, with templates and stuff, you can theoretically render (generate) a full page in Django and send that to the user
all of that runs on your server.
another way to do it is to have a backend in Django with DRF (Django REST Framework) that runs on your server, and a frontend in some form of JS that runs on the user's computer.
so (simplifying) the frontend sends certain requests to the backend, gets data needed to render the page, and then renders it for the user
this separates the rendering (frontend) from the data access (backend)
in this case, the frontend checks if the user is logged in and, if so, redirects an attempt to visit the login page to the homepage.
and on the backend there's a separate check that prevents logging in again if the user's already logged in.
In Django
Where should I store my own .py files within my project
I have a large method that needs to be called during user creation
this method is stored in its own file where it calls other methods in that file
where should I put this and how should I import it
@vestal hound that's pretty close to what I imagined. I thought that was called AJAX. Or, thats the JavaScript that contacts what in this case would be DRF?
I don't know enough JavaScript to really do that. I think that unless your app really needs that JavaScript... that that is wasteful.
But for example... I have imagined web games I could create that would be difficult to do without a lot of JS.
So in those cases I could see justifying it
In Django what is the model field that will hold an instance of a class?
I know that you can use models.ForeignKey to point to a model, but what about a class?
How to use in Django function that fetch fixtures.
that question doesn't really make sense...
(part of) the point of Django is to map Python objects (classes and builtin types) to database primitives
so a class should be represented by a model.
I want to have default rows that is in DB, but function should fetch these.
@valid cypress give an example
I have JSON files in server with Dynamic IP, and API with static IP that return Dynamic IP. This function get dynamic ip and do request for JSON, that this add to db by model. This should be done only on first startup.
@rustic pebble
On first application startup @rustic pebble
You could have a seperate script that you only run once, there is not reason to implement this into the main app since it is only used once
I am having a problem redirecting the user after payment. Basically when he pays a function on my server is triggered through js. Everything works, user gets registered and redirected but it does not set the token
Here is my code:
@app.route('/createuser', methods=['POST'])
def createuserfromregister():
reply = request.json
plan = returnid(createorder())
res = make_response("")
if plan:
firstname = reply['fullname'].split(" ")[0]
lastname = reply['fullname'].split(" ")[1]
newUser = User(username=reply['username'], password=reply['password'], firstname=firstname, lastname=lastname,
plan=plan, premium="no", about="You haven't added an about section yet",
joindate=time.now().isoformat(), accountscreated=0, email=reply['email'])
register = registerhandler(newUser)
print(register)
print(style.CYAN(
'''
[NEW PAYMENT]
''')+ style.GREEN(
"""
[USERNAME] : {}
[FULL NAME]: {}
[ORDER AMOUNT]: {}
[ORDER ID]: {}
""".format(style.GREEN(reply['username']), style.GREEN(reply['fullname']), style.GREEN(reply['price']), style.GREEN(reply['orderID']))))
return loginhandler(newUser)
This is the loginhandler.
def loginhandler(LogUser):
headers = {'alg': 'RS256'}
key = read_file('privateKey.pem')
objectuser = session.query(User).filter_by(username=LogUser.username).first()
res = make_response("")
starters = objectuser.firstname[:1] + objectuser.lastname[:1]
print(starters)
payload = {'username': str(LogUser.username), 'firstname':LogUser.firstname, 'lastname':LogUser.lastname,'starters':starters, 'aboutme': objectuser.about , 'iat': time.now()}
print(check_password_hash(objectuser.password, LogUser.password))
try:
if objectuser.username == LogUser.username and not(check_password_hash(objectuser.password, LogUser.password)):
print('Wrong credentials')
return None
else:
print('User {} has been found'.format(objectuser.username))
token = jwt.encode(headers, payload, key).decode('utf-8')
res.set_cookie("jwt", jwt, 60 * 60 * 24)
res.headers['location'] = url_for('login')
print(token)
return res, 302
except:
print("Wrong credentials")
return None
Hi all. Is it a good time to as a question here regarding Django?
Ye, that's why I'm hesitant
I'm making a pretty simple web store.
Here's my code:
def total_price(self):
return sum([item.price for item in self.orderitem_set.all()])
print(total_price())
The error is:
TypeError: total_price() missing 1 required positional argument: 'self'
I get total price in admin panel, cause it's being red like a model field. But not when I want to get it separately.
Is it a class method ?
Then you can't call it directly. You need to call it from an instance of your class
I am calling it from the instance in post_save
That's not what I see on the code you posted print(total_price())
Oke, 1 second. I was trying to simplify it here
def bp_redirect(sender, instance, **kwargs):
print("INSTANCE", instance.total_price())
Like that? Gives me the same error
It's outside the class, being called like this:
post_save.connect(bp_redirect, sender=Order)
Just to be sure, the error you get is pointing to that exact line ?
Yes
try adding weak=False to connect
Oh, hold on a sec. If I do it exactly like that, it prints total_price as 0
Although in admin panel I can see a proper value in total_price field, so I know the sum method works
try adding weak=False to connect
@bleak bobcat Nope, still having 0 fortotal_price. And it's supposed to be 33
So I thought maybe I could transform this function into a variable inside the class? Or is it the wrong way to approach the issue?
I am trying to build a Dashboard like page that will show charts and stuff, and I am using Django.
I want the page to be dynamic, so I will have to call for the data depending on what I click or choose on the front-end.
Now my question is, should I used normal django views or DRF? and why ?
@tranquil robin What do you mean by dynamic? Can you give me a specific example? I don't quite see how you can apply DRF outside of making your own admin panel (or view) rather than built it Django admin view. But in that case using Django is a bit redundant in the first place
well, if a chart is showing the data for 2019, and I click on a button and choose 2018, I need to fetch and display that data, without refreshing the page
PS: its not the admin dashboard of django
What you're looking for is AJAX
Ok, so you're using template view?
And AJAX necessitates JavaScript
@rigid laurel yes, but with AJAX i will need to "GET" a url, and that URL can be in a "Django View" or "Django Rest API"
Can it get data from your database without loading a page, technically?
yes it can
I don't even know which of you needs help. If you're already getting help, thats fine. But I can walk you through what is required to set up the dynamic graph or whatever if you'd like
@rigid laurel I am the one asking for help regarding that topic
then you don't need to use DRF necessarily, although that's definitely an option. AJAX looks like a good idea but I can't 100% confirm cause I've never used it. I use JSON, which works pretty well with JS
this is the original question
I am trying to build a Dashboard like page that will show charts and stuff, and I am using Django.
I want the page to be dynamic, so I will have to call for the data depending on what I click or choose on the front-end.
Now my question is, should I used normal django views or DRF? and why ?
Yea, you can make JS call Django using JSON or AJAX to get the data it needs to draw
From a high level overview, what you need to do is:
- Set up a Django view/url/endpoint that returns the information you want to show in the JSON format
- Write some JS that sends a GET/POST request to that endpoint
- Load that data into a graph using JS
I'm guessing you haven't done step 1 yet?
I understand and know how to do all 3 steps
βοΈ I was just gonna say that. It's the way to do it, what Charlie said
but my point is that in step 1 , I can create an endpoint using normal "Django View" or "Django Rest API".
Which one is better and why, is my question π
ah alright. If you're building your site with something like React or Vue, then you'd want to use a framework oriented around Rest APIs like Django-Rest, or FastAPI. If you're only having a few JSON endpoints, the rest HTML, then normal Django is fine
If I were designing a dashboard. I'd use FastAPI on the backend, and React on the front end
FastAPI could be replaced by Django-Rest or by Flask
Any will do. But you shouldn't mix them. It's best if you either use only views or DRF. Otherwise it will get more frustrating the bigger your project gets
You don't want to mix the frameworks. But you can serve normal JSON perfectly fine from within Django
But it depends how much you're relying on JSON
@rigid laurel You seem to know your way around Django. Can you help me solve my current problem perhaps?..
oki will try that out, thanks guys π
yw π
I haven't actually used Django in a fair while. Recently I've only used Flask and FastAPI, but those are pretty similar to Django. I might be able to help, if I can't someone else in the channel probably will be able to
I hope so, posted it a while ago and didn't get an answer
Probably best to post it again
So, I have a pretty simple online store.
In Order object I have method for calculating total price:
def total_price(self):
#...calculations...
return final_price
I get that final price in admin panel, it works fine there.
I saw this earlier actually, I don't think I can help, but someone else migth be able to
For online payment I'm trying to use post_save method, and it looks like that:
def bp_redirect(sender, instance, **kwargs):
tp = instance.total_price()
print("INSTANCE", instance.payment, tp)
So far, it's only to get the total price, not even doing anything with that value.
But that method gets 0 as total_price, not the actual value
Hope someone else can help me solve it. Should be pretty simple in theory
I'm also having trouble with something involving post_save if anyone notices a problem with this code... I don't really understand it yet. I'm using an example to learn it but its giving me a 502 Bad Gateway
woot@wsi:~/project/users$ cat signals.py
from django.db.modlels.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from .models import Profile
@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
@receiver(post_save, sender=User)
def save_profile(sender, instance, **kwargs):
instance.profile.save()
woot@wsi:~/project/users$ cat apps.py
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
# def ready(self):
# import users.signals
I have the portions of apps.py commented out which stops the Bad Gateway error.
To be honest I don't understand what is going on with those decorators enough to even begin to diagnose the problem with this code. So I might just backtrack from using this and read the signals docs.
First, you don't need if created, it's post_save, so it does that anyway.
uh... I don't quite get the purpose of this code. What are you trying to achieve?
@native tide
So... at this point I'm following along with Corey Shafer's django blog tutorial to kind of learn the different features of Django a little better. This is supposed to make it such that any time user registers an account, that it automatically provides them with a profile which otherwise has to be created in the admin page.
the code being used in the guide is here if that helps clarify what is in other files https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog/08-Profile-And-Images/django_project/users
But yeah this signals thing is the first thing he has done where I really dont understand what is going on it the code at all.
I may have to do some research on decorator syntax before it will make sense to me
Ok, so that's a useless example as in, it doesn't have to use signals at all.
But I'll try to explain.
I find that tutorial examples sometimes are that way. Thanks.
You have a model, say a User
class User(models.Model):
# User variables...
Then if you want some other action to be done, let's say a notification, you add this below:
post_save.connect(to_do, sender=User)
And then you add a method that makes that notification:
def to_do(sender, instance, **kwargs):
# notification mechanism
Hope that helps π
yes that is more something I can work with to make sense of this at least.
So that receiver decorator isnt necessary?
Its just an overcomplication?
Nope, I suggest you start like that, later you can experiment with decorators if you want. I usually write those methods like that first to ensure they work, and then I change them with decorators when optimizing code
But then again, I can't say I've alot of experience with Django
the example post_save.connect()
I think I can work with this without the decorator more easily.
I'll try it out and see what happens
Yep, because it's how program knows where to look
Also...
on post_save it tries to find to_do method and executes it. And to_do method on its side takes sender and/or instance from post_save parameters
The way he has us doing this
# def ready(self):
# import users.signals
whats up with that
obviously not commented out
Is that to avoid circular imports or something
Again, the way he does it doesn't make much sense to me =/
Right on haha. He couldnt explain it very well either.
Which is weird because thats what he excels at usually
It's working code, just probably a bad example to use on
right
Well it breaks for me.
I get a 502 bad gateway
its hard for me diagnose those.
I've learned first when was sending users e-mails on registration. A very practical example and there are alot of tutorials online
Ah that was one of the things i wanted to do soon
Look in Terminal, it'll tell you what's the problem
So... I have this running on a pretend production server.
I'm not sure how to get those same messages you get from the runserver command in nginx
im new to server admin as well
ill look into it though
ty
yw. Don't know how to help you here, I'm using PyCharm. You might want to use it as well, and then upload your latest code to the server
yeah, that is definitely what I should start doing. When I first started out with server side code I didnt really understand how to effeciently move files to the right place so I started deverloping in vim in ssh because I didnt know what else to do.
But now I know about rsync and all these other tools
And I probably should start doing that.
The whole idea of the pretend production server is to know how it works.
Dont want to have a habit of editing stuff in vim on production server haha
So.. the main reason why I can't develop on my client machine in PyCharm is because..
I cannot figure out how to get postgres to accept a conncetion from client. I remember thats why I started developing in vim on the server.
I can change it to maybe a sqlite3 on my desktop but it will just be a mess as the data isnt the same.
I basically gave up on trying to get it to connect to get postgres server to accept connection from client and I really have no interest in going back to trying to figure it out. I would rather just develop on vim.
I spend probably two weeks reading docs and trying postgres config and django configs to do it.
And Im just done haha
@native tide Did you use pgAdmin?
@native tide You need to allow the connection in pg_hba.conf
For my network, the entry looks like this: host all all 10.10.10.0/24 md5
the file is in /etc/postgresql/%version%/main/
In Django's admin, you can use autocomplete_fields = ("field1, "field2") to get the Select2 dropdown for a ForeignKey field. Is there any way to get this widget for a TextField with choices? This would just be a normal dropdown of text options rather than a dropdown of other model instances, but with the search box
Can anyone give me an idea on how I can do that with flask?
I mean the easy way, not coding related to db
These numbers are just mock ones
I used
count sessions
before_request and after are your friends
rest is just database
same goes for accounts created. fill the db with a number everytime someone creates an account, count one up
I have thought of that, but I really believed there was a flask way of doing that
CREATE TABLE t_accounts_daily ( id INTEGER PRIMARY KEY, number INTEGER, day datetime)
sorry for helping
Bootstrap documentation suggest to do this with btn-group nesting:
<button class="btn btn-secondary">A</button>
<button class="btn btn-secondary">B</button>
<div class="btn-group">
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">C+</button>
<div class="dropdown-menu">
<a href="" class="dropdown-item">C</a>
<a href="" class="dropdown-item">D</a>
<a href="" class="dropdown-item">E</a>
</div>
</div>
</div>```
But can i do also that: (?)
<div class="btn-group">
<button class="btn btn-secondary">1</button>
<button class="btn btn-secondary">2</button>
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">3+</button>
<div class="dropdown-menu">
<a href="" class="dropdown-item">3</a>
<a href="" class="dropdown-item">4</a>
<a href="" class="dropdown-item">5</a>
</div>
</div>
difference is that first one is nested into another btn-group
And aria-labelledby attribute is important for some reason or its just used for screen reader?
@frigid egret no, I use the Django ORM and to some extent PSQL to do my database, again from the server.
@tired root it sounds like you know what you're talking about because that is definitely the file that I was led to. I could never get a config to make it work though. I will try again when I wake up a little bit more. I understand a bit more about client server relations than I did when I started this so maybe I can get it to work.
As for the problem I was having yesterday, I found it just by pulling down the code to my PC and opening it up in PyCharm
from django.db.modlels.signals import post_save
That was the problem
So maybe it is worth figuring out how to get that client connection
@toxic marten don't suggest that accessibility is not important to webdevs. They will tear your head off π
Hey guys can you help me with django not displaying my images on test server?
what i have in template :
{% load static %}
...
<img src="{% static 'logo.png' %}" height=30 width=30 class="d-inline-block align-top" />
STATIC_URL = '/static/'
LOGIN_URL = '/accounts/login'
LOGIN_REDIRECT_URL = '/'
AUTH_USER_MODEL = 'localusers.LocalUser'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
error from server
[06/Mar/2020 11:04:08] "GET /static/logo.png HTTP/1.1" 404 1650
Have you ran manage.py collectstatic
Did that solve it?
So... on a production server you use gunicorn to proxy pass. On a test development server people often add something to their project url conf
Did you do that?
Let me find an example of such
Do you have something like this
in your project urls conf? Look at last line
nope
@toxic marten don't suggest that accessibility is not important to webdevs. They will tear your head off π
@native tide sorry i dont understand (in english) what do you mean? Do you say that accessiblity (screen reader) is important or not?
so according to that code i have provided where logo.png should be on my project file structure?
I'm not sure I can explain it as well as this https://docs.djangoproject.com/en/3.0/howto/static-files/
All I know is that Django cant find anything that isnt in your urls conf.
There is a complicated way of doing in production.
But that shows the development server way
@toxic marten Yes, most developers will consider the screen reader stuff important. Im not sure if the culture is the same where you live, but in my country, its often required to do it.
@tired root I'm going to try this. The 192... represents my entire local network. (I think)
I'm going to kick the server over before I test it.
fun times
is it possible that that is the wrong range?
192.168.1.66 ---> 192.168.1.254 should be what it is
I used ipcalc to get that range
β postgresql@10-main.service loaded failed failed PostgreSQL Cluster 10-m
Damn, I hate editing server files. Now I cant get postgresql to start even when I edit the file back sigh
This is why I gave up before though
One day I will remember to snapshot servers before I edit their files.
after editing that file I was only able to get my server starting postgres again by backing up my django app, reloading a snapshot of server, and pulling the django app back down.
So... I'll try it again if you have some advice on what to do differently next time.
could someone help me with CSS
@native tide 192.168.1.66 to 254 is impossible, but if your router is 254, then /24 should be correct. You can get your subnet by typing ipconfig -all or ip a . If it is 255.255.255.0 it is /24. 8 bytes for each octet, so 8*3=24.
Yeah the router is 254
What distribution are you running?
Maybe SELinux is acting up?
Do you have firewall-cmd?
I actually had to pull the snapshot back of my postgresql server failing to start because in the old snapshot my django app is too outdated. So I tried to pull it down from git but it 502 Gateway Errors. It only works the old version of the app. Its been so long since I have snapshotted that I would rather try to fix postgresql than revert. The 502 gateway errors are impossible for me to fix because they dont give me a reason. Its usually some random syntax error in my django app that causes them.
I use ufw
its ubuntu 18
Have a look cat /etc/selinux/config and see if it is either permissive or disabled
woot@wsi:/etc/selinux$ cat /etc/selinux/config
cat: /etc/selinux/config: No such file or directory
woot@wsi:/etc/selinux$ ls
semanage.conf
Security Enhanced Linux
But somehow I have to figure out what broke psql when I edited the file.
something akin to Windows group policies
putting what back?
So when I edited the pg_hba.cong file and turned the server off... ever since it refused to start postgres on startup
I changed the file back and restarted again
And it still wont
woot@wsi:/etc/selinux$ sudo systemctl start postgresql
[sudo] password for woot:
woot@wsi:/etc/selinux$ sudo systemctl status postgresql
β postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2020-03-06 12:55:10 UTC; 11min ago
Process: 1252 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 1252 (code=exited, status=0/SUCCESS)
Mar 06 12:55:10 wsi systemd[1]: Starting PostgreSQL RDBMS...
Mar 06 12:55:10 wsi systemd[1]: Started PostgreSQL RDBMS.
woot@wsi:/etc/selinux$
okay
it started
that app is still giving me this
type nmap serverip to check if 5432 is open
ok
wow
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed https
5432/tcp closed postgresql
it was totally open
ive been using it everyday
did you permanent the firewallcommand?
woot@wsi:/etc/selinux$ sudo ufw status
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
5432 ALLOW Anywhere
Nginx Full ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
5432 (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
I am not sure about ufw, but in firewall-cmd you have to type --permanent when adding, so it sticks over restarts
I turn it on and off all the time.
And the firewalls says its open
it must be closed to this IP
hold on let me nmap on server
yeah you need to nmap on the server
client is irrelevant
outgoing connections are always allowed until explicitly forbidden
yeah im having trouble installing it because of bs give me a second
Now im getting 404 on trying to install packages...
ok
Man I dont when I will learn not to edit a system file on a server without making a snapshot.
I cant imagine what people do on real servers where that isnt possible
ok
Scroll down a bit, what does it say in listen_addresses ?
woot@wsi:/etc/postgresql/10/main$ cat postgresql.conf | grep "listen_address"
###listen_addresses = '*' # what IP address(es) to listen on;
yeah let me look at the entire file
it only listens on 127.1
uncomment it and enter your network there
I am not 100%, but it should accept the network id
192.168.1.0
I really dont know how that happened
Even if I get this to work to where I can connect it from a client... I dont understand how I broke everything by editing that file and editing it back. It must have been something that changed in the system coming down and going back up
I can't tell you that either from here π
that is the whole network
oh
first IP is always the network id
since you have a /24, your network goes from 192.168.1.0 to 255
But 0 and 255 are not usable, because the first is the ID and the last one the broadcast address
Right.
Well... shit
I really cant even concern myself with trying to connect to my database from my client anymore
because the more problematic problem
ok but you said you couldn't get any packages with apt either?
let me try again
woot@wsi:/etc/postgresql/10/main$ sudo apt install nmap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libblas3 liblinear3 liblua5.3-0
Suggested packages:
liblinear-tools liblinear-dev ndiff
The following NEW packages will be installed:
libblas3 liblinear3 liblua5.3-0 nmap
0 upgraded, 4 newly installed, 0 to remove and 86 not upgraded.
Need to get 255 kB/5,468 kB of archives.
After this operation, 25.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://archive.ubuntu.com/ubuntu cosmic/main amd64 libblas3 amd64 3.8.0-1build1
404 Not Found [IP: 2001:67c:1360:8001::21 80]
Ign:2 http://archive.ubuntu.com/ubuntu cosmic-updates/main amd64 liblua5.3-0 amd64 5.3.3-1ubuntu0.18.10.1
Err:2 http://archive.ubuntu.com/ubuntu cosmic-updates/main amd64 liblua5.3-0 amd64 5.3.3-1ubuntu0.18.10.1
404 Not Found [IP: 2001:67c:1360:8001::21 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/l/lapack/libblas3_3.8.0-1build1_amd64.deb 404 Not Found [IP: 2001:67c:1360:8001::21 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/l/lua5.3/liblua5.3-0_5.3.3-1ubuntu0.18.10.1_amd64.deb 404 Not Found [IP: 2001:67c:1360:8001::21 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
yes
yes
then probably the archive down
I saw some people were uninstall postgres and reinstalling it
would that destroy the data?
Its all test data at this point but
you still have that entry in pg_hba.conf, right?
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.1.0/24 md5
# IPv6 local connections:
host all all ::1/128 md5
I thought one was commented out!
hold on
change host to hostnossl
and restart, try again
another method we could try is to change md5 to trust, but that is iffy
right.
Does the app you use do the md5 hashing?
There are all methods listed,check what that program needs
When youy say the app I use, which do you mean?
md5 was working several hours ago. with only this at least from my server host all all 127.0.0.1/32
yeah thats the django app
I cant even load my normal app. But the weirdest ass hell thing is when I reload and oldsnapshot it will suddenly work with files that are as far as i can tell the same as the files i am looking at now.
Nah not familiar
is your client on Windows or Linux?
Both are linux
https://dbeaver.io/download/ you could try and connect with this
Maybe it is the django app, idk
networking wise I've tried everything
last shot: /etc/hosts.deny
but I doubt it
I am pretty close to just loading the old snapshot, cutting my losses, and remebering to never in my life again touch my server without making a snapshot first.
ok
its a file where everything is commented out.
oh ok
was about to smash my head on the table
because I've been only looking at private IP
does the network bridge work?
can you ping it from your host machine?
let's try. I mean it was a few hours ago, which I cant let go of. haha
So I can ping the virutal host from my actual PC, but if I try to ping my actual pc from my virtual host, nothing
I think my server isnt getting internet
I pinged google.
192.168.1.197 -- virtual host,
192.168.1.152 -- client
what does it say in virtual box in the network config?
which options?
we should change that to a nat'd network
it is able to because i can ping 8.8.8.8 from it.
It just weirdly cant do a lot of things
not sure. But I able to ping my client again. Maybe I entered a typo before.
ok, but your issue is not getting in
it's the replies getting out
so, you need to look at how to make your vbox able to talk to your pc
I see
Django cannot establish a connection because it is not getting an answer
I could try to study the differences between this snap and the snap where the django app will work
Thats really all I can think to try
that was pointless, there is not much of a config when using bridged
yeah i saw that
Im loading the old snapshot and going to try to see what is different about it.
To be honest
The amount of work that would go into redoing the things to my django project that I would lost is starting to become an amount of time less than figuring this out
Which is frustrating
Because I want to know
But it is what it is
I appreciate you trying to help me. And actually, that makes sense. I think what I do want to do is go back to the old snapshot... I will have to rebuild some parts of the app, but before I do that.. I might try to see if I can play with the settings to get the database to connect.
Because being able to develop in PyCharm would be great
take an other snapshop before doing that
And if I have a snapshot i can always revert
Right
I will literally never touch my system files again without making one
Ever heard of docker @native tide ?
I have and I should probably learn to use it.
What did people do before virtual servers?
Did they just regularly destroy everything on accident?
And nothing they could do about it?
They either knew what they were doing (because they destroyed everything by accident plenty of times in the past) or had a sysadmin there to do that for them
Right.
Well, I follow several people on social media who are sysadmins and pentesters and they run services that I use and we use together
And they tell me the same thing
That they only are good at it because they have broken a million servers
@toxic marten Yes, most developers will consider the screen reader stuff important. Im not sure if the culture is the same where you live, but in my country, its often required to do it.
@native tide Thank you, can you recommend me some cheat sheet for screen reader html attribute? Its simple, but it's easy to forget about someone. So i just need a list
And they'll still break some in the future, you never stop learning
This is my first server ever. So. Ive been learning a lot from it.
Also, I dont really know @toxic marten sorry. Someone probably does though.
@native tide π
Still have to wonder
How you explain this
client, server
its an nmap of the server
But yeah, like I said when I originally described this problem
I tried to do this before.
I gave up. This would be the second time I give up on this problem.
And just go back to vim developing.
shrug. My command line skills are improving haha
I'm gonna take a break, thanks for trying to help it taught me a few things.
I actually might try to learn how to make a docker image and just do that.
@tired root I got nmap on my machine with snap.
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
The rest are closed
Do you have a remote repo for your project somewhere ?
yeah. Its acutally just a practice project, its not even my own design. Its just me going over a tutorial. But I still have it up for backup purposes.
k, can you send me the repo in PM ? And give me access to it if needed ? I'll make you a docker branch
Is that a hard thing to do? I can probably learn to do it.
here, I have it on a privately hosted gitea install that my friend runs and you wont be able to be added to it. Let me open one on github
I could make it public probably
there is nothing sensitive in it
But you wouldnt be able to pull request there
ufw allow from 192.168.1.0/24 to any port 5432
ufw allow from 192.168.1.151/32 to any port 5432 only from your host machine
by host you mean the vhost or the actual computer? Sorry the terminology confuses me still haha
host is the real one, guest is the vbox
this lets the host access the vbox
first one allows the whole network
okay let me see if i can get this right haha
Man, I would have gotten so much done today if not for this problem. I guess thats life.
To be honest I have still learned a lot of things from this.
I just wish I didnt have to have learned this way haha
from host, still 5432/tcp closed postgresql
It doesnt care about the firewall rules
wellll
Look what I found
postgres@wsi:~$ /usr/bin/pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 down postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
its this exact problem https://dba.stackexchange.com/questions/154252/psql-could-not-connnect-to-the-server-no-such-file-or-directory
I believe I will figure it out, ill let you guys know when I do. You put a lot of effort into helping me and i appreciate it
OMG
its the permissions of the file that changed.
@tired root since you spent so much time trying to help me with this I though I would show you
2020-03-06 12:55:09.956 UTC [1238] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-03-06 12:55:09.994 UTC [1238] LOG: specifying both host name and CIDR mask is invalid: ":::q:1/128"
2020-03-06 12:55:09.994 UTC [1238] CONTEXT: line 100 of configuration file "/etc/postgresql/10/main/pg_hba.conf"
2020-03-06 12:55:09.994 UTC [1238] FATAL: could not load pg_hba.conf
2020-03-06 12:55:09.995 UTC [1238] LOG: database system is shut down
the q isn't supposed to be there
should say ::1/128
unless that is something I don't know about
but ::1/128 means localhost and only this address
it looks like I added some random thing to my file I didnt know about while editing it
Im such an idiot
haha
but yeah
So the take away from this though
Is check the log file
I also fixed the thing where it wouldnt download by writing a new source list file.
Its all fixed!
Not only did I fix it. But I am now connecting to the database from my client.
I really hope that's not a browser client
Hey. I dont know if this is the correct place to do ask it.
I have an Django app running in the local network that has a view that generates a PDF with a model data.
The user opens the link, the view generates the PDF, save a copy to a local shared folder and returns the PDF in the view as content-type pdf.
The file is saved correctly at the local folder but the client doesn't always receive the PDF in the browser. It throws a TimeoutError.
There are only one person using the app at the moment.
Sometimes it goes super fast and works flawlessly, but most of the times it timesout.
I thought that the issue was because it was saving the PDF first, but I removed it temporarily and the timeout still occurs.
What could the issue be? The file is ~3.8MB.
I don't have any issue opening the pdfs on the computer that is running the server. We are on Wifi but we are not having any connection issues.
Your connection is probably to blame
Can you try to generate a very little file and do some tests, to see if the issue still occurs?
How little? few kbs?
Yes
smaller files has no issue.. im pinging my computer from hers
Well, that's probably the fault of the network
thats weird... ok well, thanks
@jagged lark timeout errors probably mean that the file took too much time to upload
if settings.DEBUG:
for each in [static(settings.STATIC_URL, document_root=settings.STATIC_ROOT),
static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)]:
urlpatterns += each
is this ugly?
I suggest you renting a server for like 2euro and have an ftp service running on it to do such tests, I have experienced same problems are urs
@native tide it is :/
That's not really pythonic
replace document root with sth
maybe just leave the param as is since you arent using the kwargs in the other param
That's django?
yes. You basically add those to the end of you url config if you're in development server only.
I knew it was ugly, that was why I asked.
I always wanted to develop on django but I have found flask very very fast and efficient
And why not urlpattern.extend([...])
Yep it is
thats the biggest thing about Django
something like '@debug` and it will automatically render debugs
It big
I do like:
@authenticated and add everything I want under there
it really helps break down your code into parts and saves you from rewriting codes
I'm not super good with decorators yet. The only one I understand in Django that I have used so far are @login_required on views that need user login for them display.
I always use a signed JWT to prevent logout even on browser close, and in order to see if a user is signed in or out I have a jwtdecoder and jwtchecker which need to be called upon every time
I should probably review basics on decorators
No it isn't
Im not the best person to ask very specific Django questions as Ive only just started myself.
Oqh
okay
Does anyone know if there are any async frameworks for backend dev?
I really love async and I want to prevent the usage of docker
aiohttp have support for creating a server, although it is probably very limited
Yea it is
Django apparently have an experimental support of asyncio https://docs.djangoproject.com/en/3.0/topics/async/
It is used for socketing
Im having trouble finding docs on the extend you speak of.
haha
Flask seemed very easy at start butnow that I am looking django
it looks even easier
wtf
All the functions other than sort are listed here
Flask is way easier than django for sure
But it is also way more limited
I dont really mind limitations
For example apparently django has a security feature that I would never use
and make my own version instead
When security is considered I usually go with whats better not whats easier
and that is why I always build very very strong infrastructures
sort?
I get it
extend
dev_server_urls = [static(settings.STATIC_URL, document_root=settings.STATIC_ROOT),
static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)]
if settings.DEBUG:
for static_url in dev_server_urls:
urlpatterns += static_url
Is this more pythonic?
It looks terrible because of how long it is
But thats what the kwarg is
that more pythonic
Yes it is more pythonic for sure
I am not sure if that is a thing on python but can you like include classes so instead of having to write settings.STATIC_ROOT you would just do STATIC_ROOT
I could save space by only importing the settings i am using.
wait you are importing them from a different file?
yes
Django is a million different files. Im not sure if Flask is the same way
Its organized chaos
you could just do:
from (filename).settings import STATIC_ROOT, MEDIA_ROOT```
right
Flask is only your files nothing more
but my structure is kind of weird
haha
I have more javascript on my files than python
I eventually need to get to the JavaScript parts of my project but one thing at a time.
I am curious though...
Can you access info in your database from JavaScript? Like, can I use the Django ORM to organize data that I will access from a JS script?
jquery
fun times
That isnt wise since javascript same as html and css is viewable by the end client
Right.
You can also create a public view using the rest API
I use queries to my db to access data
Let me give you an example
This requests my server and my server request my db for a limit, then the limit is given back and then it gets set in an element
async function getlimit() {
const url = '/limit'
const response = await fetch(url, {
method: 'GET',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow',
referrerPolicy: 'no-referrer',
});
dtresponse = await response.json();
console.log(dtresponse['User Limit']);
document.getElementById('accnumberrender').innerHTML = limit;
return dtresponse['User limit'];
}
function setlimit(limit){
document.getElementById('accnumberrender').innerHTML = limit;
console.log(limit)
}
Like, for a merchant website, you can use some AJAX for the front end that access a public rest endpoint to query objects form the article table
setlimit is smth very very bad i did
it was for testing purposes
And like this is how it looks on the python part
@app.route('/limit', methods=['GET'])
def sendlimit():
data=jwtdecoder()
username = data['username']
user = session.query(User).filter_by(username=username).first()
limit = user.dailylimit
print(limit)
return {'User Limit':str(limit)}
and this how I communicate with my db on python and js
It looks like flask fits into one function with a decorator what django spreads out across at least two/three files. lol
Yea flask is very good at keeping things straight
Well, Django is good at keeping things... modular.
but when it comes to more advanced things, it is a nightmare
The rest API is also really good for this sort of thing
I break everything in my code into functions so I dont get confused
on my main.py which is where everything gets called and use
it has around 400 functions
It looks like flask fits into one function with a decorator what django spreads out across at least two/three files. lol
@native tide
what do you mean by that?
400 function in one file?
named exactly what I use, it actually is quite handy because I can correct something from the function not from the main one it gets called
@jagged lark I have not implemented them all on there
it has the url conf on the view.
I mean, you'll be better creating a module instead
Oh sure. But for anything complex, the flask way gets annoying quickly
Each website is different though
and blueprints are much worse than the Django way
Or your file will be impossible to navigate
@rigid laurel not really
I dislike blueprints
@jagged lark exactly why I break everything into functions so I can both navigate and tinker anything I want easily
I feel like the Django way leads to generally tidier URL naming
Can you elaborate on that?
I cant comment since I havent tried both yet. I had trouble understanding why django seemed so complicated at first. But its actually genius when you realize how you can plug and play various parts of your project into any other project.
The Django way means your URLs are much more condensed into one place, not just above random functions
To be fair, you urls in Django can be spread out over multiple url confs which at first seems confusing as shit
I dunno. I really feel like Django gives you much nicer tools to structure your URLs https://docs.djangoproject.com/en/3.0/topics/http/urls/
I have
I mean use use not simple things
I find it very convenient if you want to make fast asf websites without the django overhead
I'm not disagreeing there
But to be honest both are shity
I'm just saying, I prefer the tools Django offers for managing URLs
Overall, I feel like for me FastAPI is gonna kill any use I'd have of Flask
I don't know. All I think when I do Django is, "Wow, this is taking care of so many things in the background for me." That I dont think of it as overhead. I think of it is saving a massive amount of time overall.
I have heard that fastapi is increasing in popularity
what is REST API?
Well with node you can do the following:
Develop a very very good SYNC website and then use docker spam 15 instances and have instant response
where you serve JSON instead of html @native tide
mmm. Ive seen sites do that.
The modern web architecture is React/Vue/Angular on the front end talking to a RestAPI on the backend
very little actual HTML
React is backend as well
no it isn't
I hate JavaScript. I would prefer to have a backend of Python.
Hey
I got confused
I know that I have to use JavaScript sometimes.
whats up
But I would prefer not to if I dont have to
@native tide you will eventually have to use it in your projects
How to make that Django rest api model have reference id to other model and this model in view return it's own content and also second model info (from ref. Id) inside it?
Of course
so, guys can we possibly display a image using Python?
I learned it the hard way
@dusk torrent not on console
I had a deadline which I needed to use javascript to implement updates on an element
and I had to learn. js in 12 hours
So, like see if we have a Python Program that can take numbers from the user and then display the image according to the "if" statement in the program?
and implement a socket connection without async in 3 hours
@valid cypress you could use a foreign key
Im okay with JS. Im not practiced with it and it frustrates me because similarly to you I didnt take the time to study it thoroughly. I just kind of slammed it together.
Is this possible?
I might sound ridiculous right now, but vanila javascript is quite easy
it is very similar to python
Ok, thanks
It is but it throws different errors.
and it helps you implement the features you can
And its weird.
Anyone?
If you have the logic of what you want to do
You can do it easily
@dusk torrent on native window or browser?
from IPython.display import display, Image
display(Image(filename='path/to/image.jpg'))
this is for native
I learned JS pretty much via google and w3schools, I'm quite a fan
So, i should use this command?
it is not a command haha
then?
I know from experience with my mind that when I start something new that is slightly different from what I prefer, I find every reason to complain about it. But over time.. I open my eyes to realizing it was all me.
So knowing that about me...
But to be honest this is not for webdev so you might as well ask in one of the #help channels
I think I will get used to in time.
@native tide btw learing js doubles down as c# as well kinda
it is exactly same syntax
except linq
yeah the syntax I more or less get. Es6 stuff still blows my mind sometimes and makes me have to reference.
fucking microsoft dude
But regular old JS I know the syntax of fine
Im just not practiced in building anything big
Nah me neither but I am looking of doing electron-react for my next project
I just want to continue using Django for my backend and somehow still be able to have interactive experiences in JS.
You will have to do that
But I haven't got that far yet. Im still learning Django
if you really want dynamic websites
I just dont want a backend of JavaScript though at all.
IMO, as soon as you're doing AJAX, you probably should just shift towards using React or Vue for the entire frontend
I am fine with it on front end
You still use the fetch api in React
just updating things is much easier
with props and state variables
I'm really not sure what JS frontend framework to look at when I get there
I really need to get done with my website
They seem to fall out of favor so quickly
and I am talking here god damn it
I do that all the time
This channel is addicting
I'd say React
I'd say React
@rigid laurel me too
also, the only one that I know of thats fallen out of favour is Angular
I have heard many people express disgust with angular
I'll look at react when Im ready to
haters of js
I've used angular a tiny bit, and it seemed about as good as react; but I havent used angular enough to say
main reason I'd go for react is that its the most popular - so if you want to get employed or work with others, its good to know
Just learn eveything
I mean, over time I probably will. This is what I do for fun. lol
This is kinda what I follow for backend
Its just that ive only just started
And this is what I follow for front end
It really narrows down what you can choose
and helps you build with the tools you need
You definitely don't need to learn a lot of this
yea
but its a pretty good overview
only what you need
I need to change to nosql dbs
But sql is also addicitng
I am a web addict
Going over that frontend progression
I definite got stuck trying to use packages in my project from npm that use webpack because i did not understand webpack. I had trouble with cors, too.
But... I didn't read books thoroughly about these things the way I did with Python.
I just kind of threw myself at it.
I learned python when I was 15
by trying to hack Hahaha
But then I thought that if I was to hack I would need to first get good at the language
and so forth here I am now
It happens.
Never done anything bad in my life
I have built many websites never have I done something smelly
Now if you want to be a 1337 hax0r you just install kali and use someone elses python tools haha
I had made some tools tbh
never used them
I was thinking of going back to cracking game accounts and was planning to build software for that
but as I said
web dev is addicting and couldnt do it
I have friends who are pentesters who want me to play CTF with them, but I tell them that Im just more interested in development.
They dont do anything bad but they are definitely hackers.
Where I am from ctfs and generally coding contests are not a thing
and it is quite disappointing
In the capital they hold web dev contests and I am planning to go in one though
one man team, I can build a super complete website in 2 days max
for sure
Okay so... what was said earlier about REST being serving JSON... This got me to thinking.
I can dump data that I want to use on front end to a json from the database, using python. This data isnt sensitive data about users. Its just that its easier for me to organzie certain things using the ORM in Python.
Does that make sense?
Basically Im wanting to make a webgame. It's fairly RPG like and based on text based games played in console, only its on the web in a fake JavaScript console.
I somehow need to get game mechanics from the back end to the front end because I would rather not program it in JavaScript.
Just the interface in JS
for example, this is a basic example to make sense of what im saying
Say you have character with your logged in account. That character has three items and the ability to cast magic missile. Just for examples sake.
That's information in the database I need to relate to the JavaScript frontend to display it
Because the interface is a fake JavaScript terminal
it's actually a cyberpunk themed game so its made to seem like you're a console cowboy from something like neuromancer
@native tide yea thats good
Question: I am refreshing an element with javascript when user clicks submit. The data gets updated and everything but the element value doesnt change
@rustic pebble what's the code?
backend or frontend?
this is what I am using rn
async function getlimit() {
const url = '/limit';
const response = await fetch(url, {
method: 'GET',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow',
referrerPolicy: 'no-referrer',
});
dtresponse = await response.json();
console.log(dtresponse['Limit']);
limit = document.getElementById('accnumberrender').innerHTML;
limit = dtresponse['Limit'];
return document.getElementById('accnumberrender').innerHTML = limit;
So every time getlimit gets called
it should ideally refresh the value of accnumberrender
right
It works once
but then it just resets to what it was in the start
even though the database gets updated
limit gets set to the content of accnumberrender first, and then it gets overwritten with the value of dtresponse['Limit']
hmm idk
oh right
not I can do that
let me try doing this:
document.getElementById('accnumberrender').innerHTML = dtresponse['Limit'];
yeah that might work
I should set it as var
maybe
Because I want limit to be the elements value so I can set it
For some reason it breaks
when I do that
{% if (g.permissions & 0x20) == 0x20 %} this throws a syntax error
Anyone know how to do a bitwise operation in a flask if statement
@native tide flask uses the jinja2 templating engine, which only supports a limited amount of syntax. See here for details: https://jinja.palletsprojects.com/en/2.9.x/templates/#logic
Bitwise operators are not on the list
Do you know a way to do bitwise at all in flask @native root
π
in the future, there's a method to define functions you can access in your templates, so you could do {% if permissions(0x20) %} or w/e
alright thanks
Well i figured that much lmfao
Getting KeyError: <Response streamed [200 OK]> when trying to upload a file using flask
any ideas?
Full traceback ^^^
Yeah but in my defense
This is all the code I have upload = send_from_directory(app.config['UPLOAD_FOLDER'], 'accounts.txt',)
there is a comma to much at the end
still same error tho
Let me send you the whole function I have
but this is the part that generates the code because before I added that
it worked just fine
yeah well now it does not
@app.route('/accrequest', methods=['POST'])
def accrequest():
session.flush()
data = request.json
print('Text Data = ' + str(data['txt']))
send_text = data['txt']
clientaccnumber = data['accountnumber']
upload = None
try:
dt = jwtdecoder()
user = session.query(User).filter_by(username=dt['username']).first()
print(user.dailylimit > clientaccnumber)
if user.dailylimit > clientaccnumber:
try:
if clientaccnumber < plangrabber():
server = data['server']
print(server, clientaccnumber)
response = accountextractor(server, clientaccnumber)
addaccountstodb(clientaccnumber, user)
if send_text:
accountstotext(response)
try:
upload = send_from_directory(app.config['UPLOAD_FOLDER'], 'accounts.txt')
except Exception as e:
print(str(e))
print('---Upload added---')
else:
response = {'accountnumber': -1, 'error': 'Exceeded account maximum'}
except:
response = {'accountnumber': 0, 'error': 'Please enter the correct details.'}
print(response)
else:
response = {'error':'account limit has been exceeded'}
except:
session.rollback()
response = {'error': 'An unknown database error has occured.'}
return response, upload
I don't think you can return a tuple there
hmm
Thing is that Ii want to get both the response as I utilize it on the frontend
and the .txt
Damn
Because I have two options
{'error': 'An unknown database error has occured.', file: "answer.txt"}
Blue means enabled
So if a user has clicked export in .txt
I want the data to be upload by the server and downloaded by the client
while also being added to a table I have
This is a website
no shit
the user based on criteria makes a search
the search returns some shit
The shit is displayed as an html board
which is made by js
So you mean you send the search query to the server?
Yup
Ok, that isn't an upload
No no
When the user clicks submit a query is made and the response is posted back to the user
I have added the export in .txt functionality which means that the user will both get the table with the data and download the file
Then why not just return a template with a download link?
Hmm
But anyway, just put the download link in the json and let js display it
if you are doing the js route
Bottom line: you cannot return a tuple
So there isnt a way to do this: user clicks submit => file starts downloading
upload = send_from_directory(app.config['UPLOAD_FOLDER'], 'accounts.txt')
thats what I am using
I will figure it out
maybe I will just add two js requests
one after th eother
yes, but it needs to be a response
send_from_directory must be returned from the function
Do you understand how http works?
You cannot just start a download in the middle of your code
you need to tell it to the browser
I know I use them all over my code
the browser only does something if it gets data from you
so, to start a download you need to make a response
Hmm