#web-development

2 messages · Page 57 of 1

zealous siren
#

well, more like third party calls up ID card authority and double checks to see if ID card number is valid

#

some places do use signing as well depending on security requirements

#

we cannot since we have to be sure that user is still valid so security requirements require us to check tokens after an hour

somber wedge
#

Is username password model unsafe?

tired root
#

It's used in Oauth2 for example

#

@somber wedge no

#

But look into supporting FIDO sticks

zealous siren
#

username password model how?

jagged lark
#

Calling an authority to check if it valid isn't JWT

#

JWT is stateless

zealous siren
#

you should not validate username/passwords

#

that should be someone else job

somber wedge
#

Hm so what lib should I use for auth? Cause I need to handle some secure post requests for adding content.

zealous siren
#

what lib your auth provider supports

#

Step 1) Figure out auth provider

#

Step 2) Get libraries for auth provider

#

Step 3) Figure out authenication flow

somber wedge
#

Is there any way I can be auth provider

tired root
#

Username/Password

#

There is no problem with that

#

As long as you abide by common practices

#

@somber wedge

#

Common practices:

  1. Don't enforce patterns, this is the worst
  2. Don't limit to unreasonable lengths, encourage very long pass-sentences
  3. Use Salt and Pepper
  4. Use HTTPS at all times
  5. Hash with JS before you send
  6. Optional: Use hardware token such as phone or FIDO
somber wedge
#

If I hash with js do I hash the hash again?

#

Server side I mean

tired root
#

Yes

#

You should actually revert the JS hash, then encrypt

#

That is the more correct way to say it

#

encrypt with salt, then pepper

somber wedge
#

Hm these terms sound new to me.

#

Need to look them up

tired root
#

In cryptography, a salt is random data that is used as an additional input to a one-way function that hashes data, a password or passphrase. Salts are used to safeguard passwords in storage. Historically a password was stored in plaintext on a system, but over time additional ...

somber wedge
#

But if I deploy the app behind a load balancer, do I need to setup https from LB to worker?

tired root
#

Depends on which Layer you work

#

There is OSI Layer 3 and 7 balancing

#

Layer 3 does not need a HTTPS cert, because it knows jack about that

#

Layer 7 balancing only needs https between the balancer and the client, but it would be good to have a tunnel between hosts as well

somber wedge
#

For now I'm using aws beanstalk without any LB and then rapidapi for https. There's no https between rapidapi to my aws beanstalk env. Is this bad implementation?

tired root
#

I have no clue how those work tbh, never used AWS

#

I use haProxy if I need it

#

and Apache

somber wedge
#

I mean amazon web services, to host the flask application.

tired root
#

I know what AWS is, but I've never used it

somber wedge
#

Okay. How do you host your flask app?

tired root
#

With Apache 2.4 and mod_wsgi, then enable mod_ssl

#
        SSLCertificateFile /etc/letsencrypt/live/***/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/***/privkey.pem```
somber wedge
#

No I mean where is the application actually running? Like you need a vm with 24x7 uptime?

tired root
#

If you want to have it 24/7 available, yeah

#

Can also use a root

#

depends on your scenario

somber wedge
#

So you're self hosting? The stuff runs on your local rig?

tired root
#

Depends

#

some run on my pi

#

There is no "this is the answer", in IT it always depends on the use case

#

requirements are important for an answer

#

I can give you setups from a Raspberry up to a cluster with 20 RX DEll Servers

somber wedge
#

Okay. Mine needs to be up 24/7, as it'll be used as a backend for University site.

#

So I'd rather use something like heroku/aws

tired root
#

You need to do the math. How many requests/second, how big is one request then you have the networking requirement

#

don't forget the IP and Ethernet frame overhead

#

as well tcp handshake

somber wedge
#

Isn't cloud just better? It handles all of that into a single price?

zealous siren
#

most of the time yes

tired root
#

Yes, but you need to know how many vps you need and what kind of vps

#

is 1 gb/s enough?

#

Do you maybe need more?

zealous siren
#

VPS?

#

What year it is?

tired root
#

2020

zealous siren
#

and using AWS for their compute servers

tired root
#

vps, instances, whatever, no need to be elitist

zealous siren
#

if you use web instances, they auto scale

#

that's reason not to use VPS, that whole scaling problem is taken care of

tired root
#

vps tend to be cheaper and if one vps is enough, then I'd go for it without the complexity of AWS

somber wedge
#

We have around 4000 students, and not all of them check the website. So I'd estimate around 500 requests per day at worst case.

tired root
#

500/day is nothing basically, should be good enough for heroku

zealous siren
#

you could do AWS just for learning if your university has AWS already in place

somber wedge
#

Yes rabbit I'm currently using beanstalk

#

For deployment

zealous siren
#

then stick with it, no need to regress

somber wedge
#

But my traffic from beanstalk isn't https

zealous siren
#

from beanstalk to where?

somber wedge
#

I am running beanstalk to rapidapi

zealous siren
#

Beanstalk outbound calls support HTTPS no problem

#

Beanstock doesn't care what your code calls

somber wedge
#

It's only the case if it's used behind a load balancer and the load balancer is using a https cert.

#

Mine is just a single instance without lb

zealous siren
#

you are confusing HTTP client with server

#

calls from Beanstalk application are whatever you want them to be, you are HTTP Client and you somewhat set the terms

#

calls to BeanStalk are as HTTP Server, you again can control and I'd be shocked if Amazon doesn't allow/force HTTPS

#

Azure does, I can't see AWS being that far behind

somber wedge
#

Yes but I also need to secure the calls to beanstalk? Aws doesn't provide https by default.

zealous siren
#

Teh beep

somber wedge
#

Unless I'm using a paid config with loadbalancer and api gateway or something like that.

#

I think heroku allows https by default

zealous siren
#

Ok, I guess Heroku or better cloud

tired root
#

q.e.d

#

SO what year is it now?

zealous siren
#

I haven't used AWS in 2 years, when I switched jobs, I moved to Azure, they provide HTTPS natively

#

Heroku is still serverless, AWS just provides more options

#

VPS is regressing

tired root
#

@zealous siren It really isn't

#

people use it a lot

zealous siren
#

yes it is, you have to put up with OS and all the updates

tired root
#

Sorry, but I know what I am talking about. VPS isn't regressing at all, it is our most sold product.

somber wedge
#

Okay please don't fight. I'll get more confused.

zealous siren
#

Sure, because it's what people know, doesn't make it right

#

or they have code that explodes in containers

#

trex, Heroku is fine

#

for web application

cerulean pelican
#

Hello, I'm working on a flask application and this is my route for deleting a comment

#
    if current_user.is_authenticated:
        if request.method == 'POST':
            comment_to_delete = Comment.query.filter_by(id=comment_id).first()
            db.session.delete(comment_to_delete)
            db.session.commit()
    return redirect(url_for('default_urls.watch_video', video_id=video_id))
#

however it doesnt work unless i remove the if request.method == 'POST': because for some reason the request is a get request

#

this is my html code

#
                          <li class="list-item movie-comment-remove" data-toggle="tooltip" data-placement="bottom" title="Remove">
                            <a href="{{ url_for('default_urls.delete_comment', video_id=video.id, comment_id=comment.id) }}">
                              <i class="fas fa-trash-alt"></i>
                            </a>
                          </li>
tired root
#

It's not a form

cerulean pelican
#

does it have to be a form?

tired root
#

so it's a get request

#

If you want to post, yes

cerulean pelican
#

does it change anything if its a get request vs post requ est

tired root
#

No

cerulean pelican
#

aight

tired root
#

You can make it a post request if you don't want it show up in the history though

#

so add a form with a hidden comment-id, which you then post to your function

#

It's a valid method

#

but also harden the function to recognize if the user sending the ID is the actual owner

#

you don't seem to be doing that right now either

#

Any logged in user could delete any comment right now from what I see

#

@cerulean pelican

cerulean pelican
#

yeah going to do that right now

elder nebula
#

Have anyone here made appointment booking systems using django ever? If you have, can you share what tools you used to build it?

empty pivot
#

@elder nebula haven't done it but you'll need a good ui toolkit like bootstrap or semantic UI. You'll probably want a good form library, and if your app is going to have any kind of reminders or timed features (common in appointment schedulers), then you'll want some kind of django cron library

zealous siren
#

Terabyte, there is a ton of third party that does this as well

#

and some online office suties include this feature, in particualr, Office365

quick cargo
#

Does anyone have any recommendations for a CSS framework with flask?

feral minnow
#

bootstrap

#

It can do anything

winter quail
#

👆 +1 on bootstrap

elder wyvern
#

Hey guys i'm very new to web dev and I wanted to turn a relatively simple python script into a web app, though It feels like I'm approaching this the wrong way. Is trying to transform a python script into a web app even a good approach? Or should you approach a project from a web app perspective first that uses python (if you get what i'm saying)?

#

Like my python script uses spotify api to create a playlist, but trying to integrate a function (for example) made in python that generates user authorization into a web app does not seem like a viable thing to do

pliant falcon
#

Hi, anyone knows how can I use Sass with flask? How to install it till I have the scss file?

feral minnow
#

or how i can get ": Unkown Factor"

fierce shell
#

How can you fill out a form in python?

feral minnow
#

you can use selenium

feral minnow
#

Guys do sessions in flask have a limit for the string lenght in a list?

#

The list with numbers is the normal list, the list without numbers is the same list but as a session

#

anyone has any idea?

zealous siren
#

What are you doing

kindred gate
#

Hi!

I currently am running a Flask application and am using a session to store a couple of variables, however I've noticed I can't share session data between blueprints

blueprint1.py

from flask import Blueprint, session
bp1 = Blueprint("bp1", __name__, subdomain="bp1")

@bp1.route("/")
def main():
 return session["test"]

blueprint2.py

from flask import Blueprint, session, url_for, redirect
bp2 = Blueprint("bp2", __main__, subdomain="bp2")

@bp2.route("/")
def main():
 session["test"] = "Hello"
 return redirect(url_for("bp2.main"))

when running the code and going to bp2.mydomain.com, i get a KeyError stating that session doesn't have a test.

is there any way to share the session data between two flask blueprints? thanks in advance!

#

please ping me if you have an answer

sleek hazel
#

I suspect this ties more to the fact that the cookies aren't properly shared across subdomains (rather than Flask itself)

solar spire
#

Hi, I am trying to learn flask-admin, and already having trouble. First thing in documentation in "Getting Started" section shows how to initialize empty admin interface and then open page http://localhost:5000/admin/, but when I open this page i get following error jinja2.exceptions.TemplateNotFound: admin/index.html. As I can understand this problem could be solved by copying templates from flask-admin package. But there is no word about it in documentation. Do I do something wrong?

sleek hazel
#

You might not need the same level of customization that I did there but the key bit is {% extends admin_base_template %}

solar spire
#

it is strange that there is nothing about it in section documentation

#

And then there is {% extends 'admin/master.html' %} further down in documentation. So should I make that template too?

sleek hazel
kindred gate
#

I suspect this ties more to the fact that the cookies aren't properly shared across subdomains (rather than Flask itself)
@sleek hazel how do i share cookies across subdomains? sorry i'm kinda new to Flask

sleek hazel
#

@kindred gate I haven't messed around with it much myself, but I think it's through the SESSION_COOKIE_DOMAIN config and setting it to .yourbasedomain.com to indicate you want the cookies to be shared across your subdomains. (you basically need to tell flask to change how it handles a HTTP header that tells browsers how to deal with cookies)

kindred gate
#

thank you!!

empty pivot
#

@quick cargo I like Fomantic UI a lot

blazing compass
#

Hey is there any guide to make ecommerce website using django paid or free both if available anywhere?

somber wedge
#

@elder wyvern you can create a web app with proper authentication which serves the playlist after checking the authentication. Should not be any problem.

lilac root
#

I'm new to web development in django, what would be a beginner friendly approach to hosting django applications

cobalt oyster
#

@lilac root for me, learning flask helped understand what's happening in django. But again I am new to web dev in general.

empty pivot
#

@lilac root if you are a beginner, you can get a free tier AWS Ec2 and just run your Django app in a screen / pm2 session in there. Voila, your app is online. It won't scale well for multiple users but it's a start

dense tide
#

Sorry if selenium doesn't fit the channel but I'm having a problem with my build erroring with selenium any help? Sorry for the image i took it fast.

jagged lark
#

You need to install selenium first using pip install selenium

dense tide
#

I did

#

it says selenium is installed too

#

when i do that command

jagged lark
#

Ah, pycharm probably created a venv for you, which is basically an alternate python install

#

You need to type the command into your system terminal, or run the script from pycharm

dense tide
#

i ran the command in cmd

#

before

jagged lark
#

Well, you should try pip install wheels pip install wheeland then retry

dense tide
jagged lark
#

Without an s at the end, sorry

dense tide
#

let me try now

#

Works!

jagged lark
#

Nice!

native tide
#

Hello, good people.
Can anyone comment. I need to create restAPI, I have a MySQL database and I want to make it available via api. I have never done anything like this, I have no experience. How to do it the easiest way in Python?

dense tide
#

how do you make python exit the program?

jagged lark
#

exit(), or sys.exit()

quick cargo
#

@native tide if you want ultra light weight you can use flask

#

personally i normally use Django so i can run my normal site and then backend api with oauth2

#

but depends on your use case

native tide
#

My use case look like this: I mean the simplest solution so that I don't have to learn a lot and that I can finish it.@quick cargo

#

I note that I have no knowledge about creating API. I am an absolute rookie.

#

I need information which solution will be the simplest for me. I was thinking about the Django Rest API, I know there is such an add-on.

#

If I have not worked with any framework with is better for develop and deploy Flask or Diango if I want only API?

quick cargo
#

it depends

#

Flask is considerably more lightweight but doesnt have the orm

#

django's rest framework can be harder to understand

#

but then you also have the orm and serializers

native tide
#

I already have a database in MySQL. I am its administrator, I have to make an api to this DB. I only know Python.

#

That is my task 🙂

quick cargo
#

then probs best to go with flask

native tide
#

It will be easier?

quick cargo
#

yh

#

pretty simple article for it

native tide
#

@quick cargo THX.

#

Anyone else have any opinions?

polar coral
#

Do you guys have any open source projects that use DRF in mind? I wanna look into unit testing API and get some ideas
Appreciate it in advance :)

quick cargo
#

drf?

proud dome
#

Any idea why safari just on my computer won't load my website? It has a standard SSL certificate and other browsers (even safari on other computers) will open it

#

I deleted all cache from safari manually as well

polar coral
#

Django rest framework @quick cargo

quick cargo
#

ohh, I use DRF tho sadly not open source because of some endpoints a certain company doesnt want shown sad

#
class ClusterData(generics.RetrieveAPIView):
    """ Clusters call this to post and load data """
    def get(self, request, **kwargs):
        queryset = ClusterInfo.objects.all()
        serializer = ClusterSerializer(queryset, many=True)
        return Response(serializer.data)

    def post(self, request):
        payload = request.data
        payload = payload['data']
        payload = json.loads(payload)

        cluster = ClusterInfo.objects.filter(cluster_id=payload['cluster_id'])
        if len(cluster) != 0:
            cluster = cluster[0]
            cluster.guild_count = payload['guild_count']
            cluster.user_count = payload['user_count']
            cluster.shards = json.dumps(payload['shards'])
            cluster.save()
        else:
            cluster = ClusterInfo(
                cluster_name=payload['cluster_name'],
                cluster_id=payload['cluster_id'],
                guild_count=payload['guild_count'],
                user_count=payload['user_count'],
                shards=json.dumps(payload['shards']),
            )
            cluster.save()
        return HttpResponse(status=200)```
#

i tend to use the generic api view in a class

#

you get alot of control over what fields you return overall

#

this is a pretty simple example from a quick and dirty system knockup

polar coral
#

I'm pretty sure 'all' skips id

quick cargo
#

yh

#

it takes all the non-automatic columns

#

id is just an automatically generate unique value

#

tho you can replace it with a diffrent auto field depending on db size

#

which does then show up

polar coral
#

Uh I guess gonna keep searching for unit tests

grand dew
#

Huh, anyone experienced with flask?

#

I'm having unexpected issues I cannot fix using gunicorn and nginx to deploy a flask app

#

(which is just a static website, more or less)

#

I was following both miguel grinberg's and corey schaffer's tutorials

#

at some point I stopped and went straight for deployment, and did not mess with blueprints, and all

#

I'm trying to deploy using gunicorn -w 3 my_app:app

#

where my_app only has from app import app

#

this is enough to run on the local 127.0.0.1

#

app/__init__.py has, among more, the following

app = Flask(__name__)

from app import routes

Markdown(app)

if __name__ == "__main__":
    app.run()```
#

does anyone have any idea on how to proceed now?

quick cargo
#

do you get an error

grand dew
#

not really

#

I'm wondering if I need to explicitly use the create_app()

delicate vector
#

do ya'll have any links to any free web development courses?

grand dew
#

@delicate vector I know about harvardx cs50

#

@quick cargo let me know if there's any file you'd like me to post

#

I see that miguel grinberg also made a manage.py script

delicate vector
#

what time does it start exactly

#

western time?

#

cuz I'm in Asia

grand dew
#

you take it at your own pace

tender crater
#

Does anybody have some experience in integrating Mailchimp in a Flask app? (https://github.com/VingtCinq/python-mailchimp). It's not quite clear to me if I can grab an API key without creating a Mailchimp app. When I try to authenticate via a simple API key (without creating a Mailchimp app) I get this response:

'You must provide an OAuth access token or API key'
zealous siren
#

seems pretty straight forward

#

you need API Key and username and you are good to go

tender crater
#

@zealous siren No idea, but after couple refreshes it worked without touching anything, probably it was still picking up the previous config.py.

#

Another quick one: is it possible to add a celery task as a method in a class?

#

What I'd like to achieve is to subscribe a user to a mailchimp list (I was thinking to implement a task given that I don't want the app to hang while this is executed) but it'd be nice to implement this as:

# Create new user
new_user = User(id='id_string', ...)
new_user.subscribe_newsletter(frequency='weekly')

Instead of implementing a method in a tasks.py file:

@celery.task
def subscribe(user_email, frequency):
  # Call mailchimp api to subscribe user to list

Hope it's clear enough

fair agate
#

I'm not sure how to ask for help on this django issue I am having given that troubleshooting django requires the full file system I'd guess

#

I didn't change anything with my user settings nor my post actions and for some reason both are triggering errors, registering a new account triggers a bad input to save(), and trying to create a new post for some reason reads NULL as the post author

#

perhaps screenshots of the errors might help I don't know

#

that is what is triggered when trying to create a new post via the form, you can still create new posts successfully via admin panel

#

it was previously working

quick cargo
#

i imagine

#

thats saying its getting null

#

when it is told to error if it is null

fair agate
#

it shouldn't be getting null though

#

it is looking for the author attribute which is supposed to be assigned by the post

#

the post action requires a login verified with the loginrequiredmixin

#

so it should have a user to reference and define the author attribute

#

also, upon registration this issue is happening:

#

that one makes less sense to me

queen bough
#

@fair agate What is your /register view code?

hollow flower
versed sigil
#

did you look at captcha

#
pip install captcha
hollow flower
#

did you look at captcha
I did and don't want to use it as it's really really old and not maintained.

zealous siren
#

kryptonian because doing your own captcha is like doing your own encryption

quick cargo
#

Doesnt google have a captcha api you can use

harsh flare
#

I'm having a flask linux deployment issue. In a previous deployment I had to change img src to {{ url_for('static',filename='file1.jpg')}} how do I do this if I have the imgs nested in folders in static?

cold anchor
#

filename='path/in/static/file.jpg'

harsh flare
#

damnit url_for() didn't fix the issue anyway. Getting 404 on static files...templates is fine though...

#

Dockerfile contains FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7 RUN apk --update add bash nano ENV STATIC_URL /static ENV STATIC_PATH /var/www/app/static COPY ./requirements.txt /var/www/requirements.txt RUN pip install -r /var/www/requirements.txt

#

I can't see how it's not finding the static folder, when static path is correct

harsh flare
#

if anyone has any ideas please shout. It's the final step in this web deployment and it's driving me nuts

cold anchor
#

do you know what specifically isn't finding the static folder?

#

e.g. the task running flask doesn't have access to it vs. the file doesn't actually exist where you think it might?

harsh flare
#

Docker I guess? It's the Dockerfile above that points to the static folder.

#

Could it be a permissions issue?

proud dome
#

this is a rather random one but

#

any idea why a code with this bracket reversed works? If it correct it it does not work lol

delicate vector
#

do ya'll have any links to learn web development?

#

for free

scenic willow
#

I have some questions about the gmail smtp.

  1. When it says you get 100 a day does that mean it refreshes everyday at 12 orrr a day as in a 24 hour period.
  2. Does it all refill at the same time or does it refi based on the time it was used for example - I send an email at 11am, then one at 11:30. The next day will I get that credit back at the same time or will it all be available at one specific time
scenic willow
#

Found the answer in case someone also needs this information in the future

“They apply on a rolling 24 hour basis. That means that if you have a regular Gmail account and you send 500 emails at 2:00 p.m. on Wednesday, and it takes 10 minutes for the emails to send, you won’t be able to send any more emails until 2:10 p.m. on Thursday. Another example: if you send 100 emails from 2 p.m. to 3 p.m. on Wednesday, and 400 emails between 3 p.m. and 4 p.m. on Wednesday, then you won’t be able to send any emails until 2 p.m. on Thursday, at which time you’ll be able to send a max of 100 emails. After 4 p.m., you’ll be able to send more.”

thick granite
#

Does anyone know what are the best tools for creating a simple coding website?

#

I have a university assignment where we have to implement some kind of 'quiz' web app (using Flask), with separate interfaces for admins to create quizzes, and people to take them.

I want to create a web app for teachers / lecturers of CompSci / SoftEng units to be able to create coding exams, and students to take them on the app (bc srsly taking coding exams in pen and paper is the worst).

How hard would it be to implement a simple version of this? I don't even know where to start in terms of having an interpreter IN the browser, and I'm aware that doing this blindly leaves huge security risks. Even if it was just one language (eg. Python) would be fine.

delicate vector
#

thanks, bud

harsh flare
still depot
#

Hey, could someone explain me, please, how django apps work? F. E. I have a blog project, what apps I should add? Should I add an app for login/registration, for posts, for settings, profiles..?

dry pawn
#

@still depot You decide, it's about factorization and modularity

#

An app will tipically define models and views.

#

You have to decide what should go together

#

and put it in an app

#

If it's a small project, you could put everything in the same app.

#

Putting the authentication in another app makes sense though. That's what I'm doing.

#

Well, that's if you're handling authentication yourself, you could use a library such as allauth.

#

Or Django builtin.

still depot
#

Thanks. And what should you recommend to do in the blog site? Should I create one app for the blog, another for the login and stuff and another for an admin panel? Or should I split blog app into more apps?

dry pawn
#

That's a vast question. It depends on the complexity of your project. The purpose of structuring your project is mainly about maintainability. Is stuff easy to find ? Are you surprised to find stuff in some directories (you shouldn't) ? Is it easy to know if there is stuff or there is not ?

#

I'll make the hypothesis your project is rather small so, in your shoes, I'd use Django builtin admin and authentication system. So you don't have much to code.

#

And you could put everything in a single app.

#

I did that for a test project and I ended up with only 3 urls for profile and register. All the rest is handled by Django.

still depot
#

Oh, got it. Thank you very much.

harsh flare
#

Fixed my static files issue...just pointed STATIC_URL to the path instead

#

Does anyone know with digitalocean droplet and docker how I would point a custom domain to the ip:port?

wild thunder
#

hey guys, very newbie question, any quick explanation about <input type="file"> ?
how does it upload, how can i specify where it's stored? it stays inside a database? does a database stores images?

rustic pebble
#

It can store images if they are converted to base64

wild thunder
#

and files? how does it work? like, .xls, .pdf, .doc

#

if it could create a folder with customer name as it's name and store files inside

#

would be perfect

#

i'm using flask

#

the folder creation i guess i already know how it works

#

but uploading it (in interface) and sending to customer folder

#

sounds 'easy'

toxic marten
#

remember to use enctype attribute when working with files, it's easy to forget

inner stump
#

hey guys I have a very quick question please

#

and this

#

and I defined usr=user

cold anchor
#

usr=user should be an argument in your url_for function call, not the redirect function call

inner stump
#

thank you so much that was a very silly mistake than you very much for the clarification 💙

native tide
#

hello everyone, I am having an issue with django

#

I hope you guys can help

#

I have two tables, CustomUser and Client

#

there are 3 types of CustomerUsers,

STAFF_LEVEL = (
    ('1', 'Associate'),
    ('2', 'Manager'),
    ('3', 'Partner'),
)
#

now when a user is creating a client, it needs to be assigned to a partner

#

the problem is, the form I created is listing ALL users, in the field I have as 'partner' and this is wrong

#

but I failed

queen bough
#

@native tide Not certain why, but can you add print(kwargs) and paste the output.

native tide
#

@native tide Not certain why, but can you add print(kwargs) and paste the output.
@queen bough interesting, thanks for teaching me something here.

here is the output: {'initial': {}, 'prefix': None, 'instance': None}

queen bough
#

Is __init__ in the view?

native tide
#

I am not sure... my django/python experience is limited to just completing Django for Beginners

#

I am going to say no..

queen bough
#

The "view" is the ClientCreateView class.

#

Which class did you put the __init__ in?

native tide
#

I have edited it out

#

but partner is in that field so you can see the full section

#

Which class did you put the __init__ in?
@queen bough form

queen bough
#

Can you print kwargs in get_form_kwargs?

native tide
#

it is blank {'initial': {}, 'prefix': None, 'instance': None}

#

which makes sense, the error I am getting says it cant find it

#

def init(self, *args, **kwargs):
partner = kwargs.pop('3')
super(ClientForm, self).init(*args, **kwargs)
self.fields['partner'].queryset = CustomUser.objects.filter(function=partner)

#

something is wrong with that

queen bough
#

What's "it"?

native tide
#

def get_form_kwargs(self):
kwargs = super(ClientCreateView, self).get_form_kwargs()
print(kwargs)
kwargs.update({'3': self.request.user}) <------ this line gives an error
return kwargs

queen bough
#

Ah right.

native tide
#

init() got an unexpected keyword argument '3'

queen bough
#

Can you print(self.request)?

native tide
#

Can you print(self.request)?
@queen bough <WSGIRequest: GET '/pms/new/'>

queen bough
#

Which python version are you using?

native tide
#

3.7

queen bough
#

OK, can you do print(dir(self.request), vars(self.request))

native tide
#

that is pretty huge

#

what would you like me to find in the print out?

queen bough
#

Yup.

#

Huge?

native tide
#

it print out all my directories

queen bough
#

Oh right.

#

Do the form values appear at all?

native tide
#

nope

#

lol

#

wow

#

why am I having such a hard time with this?

queen bough
#

Try printing self.fields

somber wedge
#

Anyone can tell me if it's possible to use GitHub actions to auto commit a file in the repo?

queen bough
#

Just to clarify - where do you expect partner to come from in the form?

#

@native tide

hollow flower
#

Doesnt google have a captcha api you can use
What part of no 3rd party services cannot people understand?

kryptonian because doing your own captcha is like doing your own encryption
@zealous siren Maybe so, but I don't want to give data to Google nor any 3rd party service.

native tide
#

Just to clarify - where do you expect partner to come from in the form?
@queen bough it should come from the CustomUser table

#

print(self.fields) is also blank @queen bough

#

what am I missing?

queen bough
#

To access partner you'll need to get it from the Client model object.

#

Can you paste the Client model?

native tide
#

RISK_RATINGS = (
('1', 'Low'),
('2', 'Medium'),
('3', 'High'),
)

DEPARTMENTS = (
('A', 'Audit'),
('DA', 'Deal Advisory'),
('FRM', 'Financial Risk Management'),
('ITA', 'IT Advisory'),
('IRM', 'Information Risk Management'),
)

DESK = (
('0', 'Partner'),
('1', 'Risk Management'),
('2', 'Managing Partner'),
('3', 'Finance'),
)

class Client(models.Model):
client_onboarder = models.ForeignKey(
get_user_model(),
on_delete = models.SET_NULL,
null=True,
)
client_name = models.CharField(max_length=140)
is_individual = models.BooleanField()
address = models.CharField(max_length=140)
town = models.CharField(max_length=140)
country = models.CharField(max_length=140)
postal_code = models.CharField(max_length=140)
email = models.EmailField()
telephone = models.PositiveIntegerField()
client_evaluation_date = models.DateField()
next_year_end = models.DateField()
partner = models.ForeignKey(CustomUser, on_delete = models.PROTECT, related_name='client_partner')
client_type = models.CharField(max_length=140)
industry = models.CharField(max_length=140)
parent_company = models.CharField(max_length=140)
parent_reference = models.CharField(max_length=140)
duns_no = models.PositiveIntegerField()
is_sec = models.BooleanField()
is_global_client = models.BooleanField()
is_quoted_locally = models.BooleanField()
slp_approval = models.BooleanField()
tog_10 = models.BooleanField()
client_risk = models.CharField(max_length=1, choices=RISK_RATINGS, blank=False, null=False)
desk = models.CharField(max_length=1, choices=DESK, blank=False, null=False)

queen bough
#

@native tide In the get_form_kwargs can you add:

object = self.get_object()
print(object)

It should be the client model object.

native tide
#

ClientCreateView is missing a QuerySet. Define ClientCreateView.model, ClientCreateView.queryset, or override ClientCreateView.get_queryset().

queen bough
#

How about get_context_data?

native tide
#

hold on

#

lets take a step back

#

all I am doing is using a generic CreateView class

queen bough
#

Right the aim is to get the partner value from the view (after finding where it is).

#

And then use that partner to filter the CustomUsers.

native tide
#

wait a moment, here is the logic in my head, then you tell me if you are understanding correctly, the CustomerUser table has the list of users with the attributes

queen bough
#

Yes.

native tide
#

class CustomUser(AbstractUser):
DEPARTMENTS = (
('A', 'Audit'),
('DA', 'Deal Advisory'),
('F', 'Finance Department'),
('RM', 'Risk Management'),
('FRM', 'Financial Risk Management'),
('ITA', 'IT Advisory'),
('IRM', 'Information Risk Management'),
('MPO', 'Managing Partner Office'),
)

STAFF_LEVEL = (
    ('1', 'Associate'),
    ('2', 'Manager'),
    ('3', 'Partner'),
)
area = models.CharField(max_length=3, choices=DEPARTMENTS, blank=False, null=False)
secondary_area = models.CharField(max_length=3, choices=DEPARTMENTS, blank=True)
function = models.CharField(max_length=1, choices=STAFF_LEVEL, blank=False, null=False)
#

so, CustomerUser how I defined has function

#

which has the three levels

#

Client has a foreign to CustomerUser

#

my thinking was to simply run a query set to filter out and do a standard function=3 run

queen bough
#

So that you can get all the CustomUsers with the Partner function?

#

!code

lavish prismBOT
#

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:

```python
print('Hello world!')
```

Note:
These are backticks, not quotes. Backticks can usually be found on the tilde key.
• You can also use py as the language instead of python
• The language must be on the first line next to the backticks with no space between them

This will result in the following:

print('Hello world!')
native tide
#

So that you can get all the CustomUsers with the Partner function?
@queen bough exactly

#

and that would be linked to the form

queen bough
#

I see. So where should/does the partner value come from?

#

and that would be linked to the form
@native tide G2G, sorry I couldn't help. I'm not sure of the implementation details but if you can work out how to access the Client model object being controlled by the view then you should be able to access its .partner field. If you are creating a Client then you'll have to work out how to access the passed parameters (self.request.POST I think) and filter based on one of the parameters passed.

native tide
#

ok thanks for everything @queen bough

nova storm
#

can anyone suggest me some course for Django

#

or flask

#

first tell me which one will be good. django or flask?

#

!code

lavish prismBOT
#

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:

```python
print('Hello world!')
```

Note:
These are backticks, not quotes. Backticks can usually be found on the tilde key.
• You can also use py as the language instead of python
• The language must be on the first line next to the backticks with no space between them

This will result in the following:

print('Hello world!')
cold anchor
#

either is great to learn, both have tutorials as part of their documentation site

nova storm
#

i want to make my carrier in web dev

cold anchor
#

then I'd suggest django, its tutorial covers a very wide range of its features

nova storm
#

okay

#

any links?

cold anchor
#

to get the same functionality in flask you have to configure libraries or make it yourself

tropic cargo
#

hey, very new to this, started my first project today, trying to make a webscraper. Inside my container, I'm trying to pull out the info inside the SECOND div of a parent div, not the first. How can I do this? Thanks.

#

After defining the container and putting in

container.div

#

what goes next after that if I don't want to call the first div in that div inside that container by using

container.div.div

#

instead I want to call the second div inside the first div so

container.div.(what goes here)?

#

I could always call the whole container.div but I'd rather just get the individual piece of info out of it

young grove
#

Hei guys I needed a bit of help with Django

quick cargo
#

whats up

young grove
#

Good

viscid spoke
#

Hi . everytime I run my webapplication locally it runs on a different port
http://localhost:50584/ 1st try
http://localhost:51117 2nd try
I would like to have it always fixed on some specific port
I need to redirect back a Oauthentication code back to a specific port that I should already know . and it is kinda impossible with the project choosing a random port everytime

young grove
#

WBU?

quick cargo
#

@viscid spoke you're flask right?

viscid spoke
#

yes sir

quick cargo
#

@young grove im good, whats ur issue

#

@viscid spoke how are you starting the flask server

viscid spoke
#
"""
The flask application package.
"""

from flask import Flask,request,render_template,redirect,session
client_id="705765391510798408"
client_secret=""
scope="identify"
redirect_url="http://127.0.0.1:50000/login"
discord_login_url="https://discord.com/api/oauth2/authorize?client_id={}&redirect_uri={}&response_type=code&scope={}".format(client_id,redirect_url,scope)
app = Flask(__name__)
@app.route("/",methods=["get"])
def index():
     return redirect("discord_login_url")
@app.route("/loggin",methods=["get"])
def login():
    return "logged in"
import FlaskWebProject1_oAuth.views

Idk if this will answer your question but I am literally using Visual studio flask project without editing anything

young grove
#

I'm facing a problem with the code Django, a bug to be more specific, that is when I'm adding an item to the cart for the first time(with variations let's say Red and Medium), it's being added nicely. Then when I'm adding another item(let's say Blue and Large), it's also working. But when, I'm increasing the item quantity from the order_summary.html, it's increasing the quantity of the other item not the one I clicked(if I clicked Red and Medium, Blue and Large's quantity is increased) and says : Please specify the required variations. Why is this happening? Can anyone please help me out? Thanks in advance!

quick cargo
#

@viscid spoke are you using vs to run the flask server?

viscid spoke
#

yes

quick cargo
#

go into the setting for vs where you select what to run

#

should be a port option

#

@young grove i take it you're using templating right?

young grove
#

Yea

viscid spoke
quick cargo
#

yup

#

that will fix the port

young grove
#

My models.py:

class Item(models.Model):
   title = models.CharField(max_length=120)
   price = models.FloatField()

class Variation(models.Model):
   item = models.ForeignKey(Item, on_delete=models.CASCADE)
   name = models.CharField(max_length=50) # size, color

class ItemVariation(models.Model):
   variation  = models.ForeignKey(Variation, on_delete=models.CASCADE)
   value = models.CharField(max_length=50) # small, medium large etc

class OrderItem(models.Model):
   user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
   item  = models.ForeignKey(Item, on_delete=models.CASCADE)
   item_variations = models.ManyToManyField(ItemVariation)
   quantity = models.IntegerField(default=1)
   ordered = models.BooleanField(default=False)

class Order(models.Model):
   user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
   ref_code = models.CharField(max_length=20)
   ordered = models.BooleanField(default=False)
   items = models.ManyToManyField(OrderItem)
   start_date = models.DateTimeField(auto_now_add= True)
   ordered_date = models.DateTimeField()
quick cargo
#

can you send the snippet where you have the templating in the html aswell

#

and where you inject the template

viscid spoke
#

gracias amigo . what a great guy ! have a good night

#

thank you

quick cargo
#

np 👍

lavish prismBOT
#

Hey @young grove!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

young grove
quick cargo
#

you need to click save btw

#

otherwise it wont actually show the code :P

young grove
#

My urls.py:

urlpatterns = [
    path('admin/', admin.site.urls),
    path('add_to_cart/<slug>/', orders_views.add_to_cart, name='add-to-cart'),
    path('remove_from_cart/<slug>/', orders_views.remove_from_cart, name='remove-from-cart'),
]
#

My order_summary.html (where I can increase quantity):

<a href="{% url 'remove-single-item-from-cart' order_item.item.slug %}" class="btn mr-2"><i class="fa fa-minus"></i></a>
{{ order_item.quantity }}<a href="{% url 'add-to-cart' order_item.item.slug %}" class="btn ml-2"><i class="fa fa-plus"></i></a>
#

If you need anything more, please inform me....

quick cargo
#

that should be fine

#

been a while since i did django templating lol

young grove
#

Again, to sum it up, I'm facing a problem with the code, a bug to be more specific, that is when I'm adding an item to the cart for the first time(with variations let's say Red and Medium), it's being added nicely. Then when I'm adding another item(let's say Blue and Large), it's also working. But when, I'm increasing the item quantity from the order_summary.html, it's increasing the quantity of the other item not the one I clicked(if I clicked Red and Medium, Blue and Large's quantity is increased) and says : Please specify the required variations. Why is this happening? Can anyone please help me out? Thanks in advance!

quick cargo
#

thats weird

gloomy pendant
#

I think that I'm fucking love django

#

It is perfect django 😍

quick cargo
#

its good

#

tho for somone like me who's doing a site for their finals

#

cant rlly use it

#

cuz DBs are big marks and orms dont give ya points

gloomy pendant
#

Django is everything

#

No sql, no php

#

Fantastic 😍

#

And django-admin?

#

Legendary 😍

quick cargo
#

you know what they say tho

#

Proper writen sql will always be faster than an orm

#

:P

gloomy pendant
#

Well yes, but actually no 🤣

quick cargo
#

lol

#

flask with a custom wrapper

gloomy pendant
#

Really cool

#

Nice man

#

Is it online?

quick cargo
#

only local host rn

#

actual deployment gonna be such a interesting kettle of fish lol

gloomy pendant
#

🤣

#

I used to host my website on aws lightsail

#

3$ per month is really cheap

quick cargo
#

oof

#

i pay about $200 / mon for my hosts rip

gloomy pendant
#

Now I'm trying to host my websites on my old pcs at home 🤣

#

I use dynamic dns 😉

quick cargo
#

noice

gloomy pendant
#

And some NAT rules on my router

#

Of course a DMZ to protect all my personal devices in my lan

quick cargo
#

My router came setup with NAT out of the box which was both a nice thing and also a rather annoying thing when attempting to route somthing or other

gloomy pendant
#

F

#

My router is free with my provider lol

quick cargo
#

hehe mine wasnt

#

if you want my advise

#

dont get an asus router

#

they cost an arm and a leg and last like 4 months

gloomy pendant
#

Ah

quick cargo
#

tho the warranty is reliable i dont enjoy going through 6 routers 2 years

gloomy pendant
#

Eheh

#

"My" router is Zixel lol

#

Sometimes my providers give Fritzbox that is really good

#

So I was praying to have it

#

But they gave me a Zixel

#

That isn't really famous

quick cargo
#

rip

#

If i get another router i might try netgear out

gloomy pendant
#

It is also really good

#

Cisco is the best 🤣

quick cargo
#

i would love a cisco router

#

but damn the cost

zealous siren
#

I'd say Cisco is best if you are running multi Gbps pipes

#

otherwise, all you are paying for is the na,e

native tide
#

hi i am learning django and i have a question

#

so i see this

#

to me it looks like I am mapping the same url twice

#

what am i not getting?

urban talon
#

hey guys I need help I need to create a form where people fill it out and when they press send it gets inserted into a database
i have the UI finished, and the flask server running, the flask server is connected to the oracle database
but I dont know how to actually send the information to the flask server

midnight flame
#

idk if this is the write channel but can anybody tell me why this doesnt work?

from selenium.webdriver import Chrome
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from time import sleep
driver = Chrome()
driver.get("https://www.youtube.com")
WebDriverWait(driver, 600).until(expected_conditions.presence_of_element_located(("css selector", "#button"))).click()
sleep(30)
driver.quit()
#

it is supposed to open up youtube and click sign in

midnight flame
#

nvm, i figured it out!

outer apex
#

@urban talon Do you have the HTML written out already? The form element on the HTML side essentially gets the browser to send data to the server via a POST.

toxic marten
#

hey guys I need help I need to create a form where people fill it out and when they press send it gets inserted into a database
i have the UI finished, and the flask server running, the flask server is connected to the oracle database
but I dont know how to actually send the information to the flask server
@urban talon ```
@app.route('/your_route', methods=['GET', 'POST'])
def your_view_function():
form = YourForm()
if form.validate_on_submit():
number = form.number.data
yourObject = YourClassModel(number=number)
db.session.add(your_object)
db.session.commit()
return redirect(url_for('somewhere'))
return render_template('somewhere.html', form=form)

#

this is an example, i supposed you have a form, and you have to fill a number

#

to me it looks like I am mapping the same url twice
@native tide So, see the directory, polls and mysite, two different things. mysite is the project folder (the main folder) and polls is an app of your website (remember concept of django modularity).

young grove
#

Bros any help for me?

toxic marten
#

@native tide mysite/urls.py basically says that there are 2 main apps, admin/ and polls/, and inside /polls notice that there is the method include('polls.urls'). So in your localhost for example, if you type 127.0.0.1:8000/polls/, first django goes into mysite/url.py and search for a match, it find polls/, then it goes into polls/urls.py and it search for another match

#

That help you for better mainteined code, its bad have all routes inside one files

young grove
#

I'm stuck

#

Can't deploy my web app for this bug

toxic marten
#

which bug

young grove
#

I'm facing a problem with the code, a bug to be more specific, that is when I'm adding an item to the cart for the first time(with variations let's say Green and Medium), it's being added nicely. Then when I'm adding another item(let's say Blue and Small), it's also working. But when, I'm increasing the item quantity from the order_summary.html, it's increasing the quantity of the other item not the one I clicked(if I clicked Red and Medium, Blue and Large's quantity is increased) and says : Please specify the required variations. Why is this happening? It's also worth noting that when I'm adding the same item with same variations from my single product page, then it's working fine. I think this bug is occurring because of the way my views is written. I tried to solve it myself, but I'm getting lost

dense tide
#

how do i get a ng-bind in selenium?

cloud path
#

hey guys, can anyone help me please? i don't manage to upload images with flask

amber moat
#

i'm trying runtime.getManifest() to get the complete manifest.json file for a web extension, serialized to a JSON object but it says runtime not defined ?

cold anchor
#

is that where you're running that code?

native tide
#

@amber moat have you specified the runtime?

You need to specify the browser that you want to run it on

The syntax is browser.runtime.getMainFest()

amber moat
#

@cold anchor the extension is a bookmarks manager, and whenever i open a new tab it always shows up

#

@native tide now i get this error TypeError: browser.runtime.getManiFest is not a function

#

am i missing any step ?

native tide
#

@amber moat try to fetch some of the data from json say name

You can try this
var manifest = browser.runtime.getManifest(); console.log(manifest.name)

amber moat
#

that works well and prints out the name key, but how do i list all the manifest keys ?

native tide
#

@amber moat you need to parse the JSON. As the function returns an object in our case manifest then you can just apply parsing to that object

amber moat
#

Ok thanks rdbaker and DarkShadow i got it.

fiery marlin
#

Hey so today I was spammed by someone who created group chats and added me. I'm sorta new to selenium and I plan on making it whereby I leave the group for which the user spammed me. I did contact discord regarding the incident in hopes of them helping me. However, it will some time for them to respond and I'm not sure how they will respond to my situation where it be removing me from the group the spammer decided to add me or not. So I'm asking assistance in regards to creating a simple script with selenium which leaves the groups that I'm in with the spammer.

#

discord on chrome for selenium to work

quiet solstice
#

I'm sorry but automating discord goes against discord tos so isn't something we'll help with .

#

!rule 5

lavish prismBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious/inappropriate or be for graded coursework/exams.

fiery marlin
#

Ooof

#

Alright so should I just wait for discord to respond?

#

@quiet solstice

quiet solstice
#

Yes

fiery marlin
#

Alright.

sonic flicker
#

nicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 3220: ordinal not in range(128)
Facing this issue does anybody has any idea its on my docker

knotty seal
#

I am trying to use flask to build one of my first pages. I have built a table in HTML and I want to return the form data to python. I am not sure how to go about it. Here is my table:

{% extends "base.html" %}

{% block content %}
<!-- Entry form in bootstrap Book, Author, Rating -->
  <form action="{{ url_for('table') }}" method="POST">
    <div class="form-group row">
      <label for="book" class="col-sm-2 col-form-label">Book Name:</label>
      <input type="text" placeholder="Book Name" id="book" name="book">
    </div>
    <div class="form-group row">
      <label for="author" class="col-sm-2 col-form-label">Author:</label>
      <input type="text" placeholder="Author" id="author" name="author">
    </div>
    <div class="form-group row">
      <label for="rating" class="col-sm-2 col-form-label">Rating (Out of 10):</label>
      <input type="text" placeholder="Rating" id="rating" name="rating">
    </div>
    <div class="form-group row">
      <button type="submit" class="btn">Submit</button>
    </div>
  </form>
  <hr>
{% endblock %}
#

I have a view function set up in python as follows:

@app.route("/table")
def table():
surreal tangle
#

@knotty seal tyically the route that renders the form will handle both the GET request (first render of the form) and POST request (when user presses submit)

#

you can have a branch in the route on the condition request.method == "POST" and handle the form data from there

#

you need to add @app.route("/table", methods=["GET", "POST"]) to allow both request types

fiery marlin
#

Is there anyway of using selenium to find by text?

#

driver.find_elements_by_xpath("//*[contains(text(), 'My Button')]")

#

is this way?

knotty seal
#

@surreal tangle - Thanks. I have now written the display in python as:

@app.route("/entry", methods=["GET", "POST"])
def entry():
  if request.method == "POST":
    bookName = request.form["book"]
    authorName = request.form["author"]
    rating = request.form["rating"]
    print(f"Book: {bookName} Author: {authorName} Rating: {rating}")
  else:
    return render_template("entry.html")
surreal tangle
#

👍 works as expected?

knotty seal
#

@surreal tangle - I had to add a return in the POST conditional, but yes, it works 🙂 Thanks!

surreal tangle
#

great 😄 and np

knotty seal
#

Now to create a table that updates dynamically after each input... 🤣

severe swan
knotty seal
#

I don't @severe swan, but I have been doing that tutorial too. It's a bit too complicated for me at the moment, but has taught me a lot.

cold anchor
#

I usually make that decision based on what type of service/product it will be. Single app with minimal "external" functionality? -> flask app by itself. Enterprise or consumer app that has a lot of bells & whistles? -> flask as API with react on top

fickle fox
#

Does anyone know how to protect db from sql injection? (flask, sqlite)

tired root
#

@fickle fox Always use bound statements

#

validate your inputs

#

Treat user input as hostile

severe swan
#

@cold anchor that's a good thought & partially the way I was thinking. Have me and my wife use it as is & then build an API for my front-end to interact with instead of using direct routes with direct DB calls. And then if I want to move it forward, just build React on top of the API I have built.

cold anchor
#

using declarative sqlalchemy will take care of 90% of that

fickle fox
#

Wait wait how to trwat it as hotstile or to use bound statement?

tired root
#

Hostile means, assume that every data you receive has potential attacks in them

#

So validate in JS, validate on the server

#

see if what you get makes sense

#

As in, run a regex or whatever to see if the email address contains an @, or if it's bullshit

#

As I always like to say: a plain bullshit filter

fickle fox
#

Oh okay

#

And what is best eay to hash pw in flask?

#

Way*

tired root
#

You hash it in the db

#

not in flask

cold anchor
#

you store the hash in the db

tired root
#

psql for example has a good facility to salt and pepper passwords

cold anchor
#

but hash it in your programming language

tired root
#

this way you don't even need to take care of that

cold anchor
fickle fox
#

So there is no something as argon2id?

#

Okay so if bcrypt is best i will go with it

tired root
#

Here is an example from my code:

#------------------------------------------------------------------------
def db_get_admin_login(user:str, pwd: str):
#------------------------------------------------------------------------
    cursor = get_database().cursor()
    try:
        cursor.execute("""
                        SELECT id_pi_settings
                        FROM t_pi_settings
                        WHERE backend_username=%s and
                        backend_password=crypt(%s, backend_password);
                       """, (user,pwd,))
        result = cursor.fetchone()
        if (result is not None):
            return bool(result[0] == 1)
        return False
severe swan
cold anchor
tired root
#

Not all db can do that, but if it can, I'd suggest using it

cold anchor
#

and kind of nice, but it raises a good point: the unhashed password is floating around your system a lot longer and it liable to be logged in things like queries

fickle fox
#

Sqlalchemy?

tired root
#

It's a orm system

fickle fox
#

Sqlite is now something i am using

tired root
#

Basically it abstracts the database interaction into OOP

#

you can exchange the backend at any point

fickle fox
#

Thanks i will try it :D

vagrant adder
#

@severe swan that's very popular setup, miguel shows how to create static website

#

nothing wrong with it

tropic hinge
#

I'm currently trying to make a simple wishlist using django and was currently trying to render something if the wishlist has no items, but it doesn't show up

   <h1>Wish List Items</h1>
   {% for item in item_list%} {% if item_list|length == 0 %}
   <h3>No Wish Items Exist</h3>
   <hr />
   {%else %}
   <h3>Hello</h3>
   {% endif %} {% endfor %}
 </body>```
I noticed that when I do Items.object.all() in the shell, it says Item has no attribute object, but not sure how to fix it
cold anchor
#

you're rendering your conditional that checks if the length is 0 inside the for loop, but since the length is 0, it doesn't enter the for loop

#

move the if/endif block to outside the for block

tropic hinge
#

oh got it

#

thanks

fickle fox
#

why i get this error

tropic hinge
#

so i added some items to the wishlist using the adnin so i checked it using the shell, so it should display hello

#
>>> Item.objects.all()
<QuerySet [<Item: Laptop>]>```
#

on the webpage, it still says no wish items exist

tropic hinge
#

alright i fixed it

knotty seal
halcyon river
#

Hi. Does anyone have experience pulling reporting from DCM api?

native tide
#

Guys is there a way to populate flask_Wtf hiden form with jinja ?

ionic birch
#

you could render a field like {{ form.email(class_="hidden") }}

#

is that what you are asking?

native tide
#

nope

#

its like having for loop with jinja

ionic birch
#

class wtforms.fields.HiddenField

native tide
fickle fox
#

does anyone know why i get error 'post' undefined

#
def edit(id):
    if request.method == "POST":
        post = BlogPost.query.all()
        post.title = request.form['title']
        post.content = request.form['content']
        post.author = request.form['author']
        db.session.commit()
        return redirect('/posts')
    else:
        return render_template('edit.html')```
quasi ridge
#

it's probably not coming from that code. Paste the stack trace. (And you might ask in a regular help channel)

native tide
#

Hi again! Im following this django tutorial, for a particular view function, the last line is return HttpResponseRedirect(reverse('learning_logs:index')), to be executed upon a valid form submission.

in the template for that page, the form ends with <input type="hidden" name="next" value="{% url 'learning_logs:index' %}" />

#

is this not redundant?

#

because the button redirects you but then so does the app once you submit

native tide
#

Should i use Vanilla JavaScript or Jquery when i am building a website's frontend?

native tide
#

which one is better?

#

if you have no prior knowledge of jquery and you just want to sprinkle some js in your html I think you're fine with vanilla

cold anchor
ember kayak
#
  • Environment: production
    WARNING: Do not use the development server in a production environment.
    Use a production WSGI server instead.
  • Debug mode: off
    Usage: flask run [OPTIONS]

Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.

#

idk whats wrong

#

nvn

dawn ember
#

anyone familiar with Quart?

#

I'm having an ImportError that I'm having a difficult time solving

#

ImportError: cannot import name '_lookup_app_object' from 'quart.flask_patch.globals'

native tide
#

does anyone know where I can go to receive help with css?

wild thunder
#

what is your query? @native tide

#

guys, i'm having an strange error.

my flask app runs, i can see my pages, all imports are done, but the page seems to not interpret my User class.

somber wedge
#

Is heroku hobby tier worth it

thick granite
#

anyone know how to "un-init" a flask-sqlalchemy database?

#

learning sqlalchemy, made a bunch of mistakes and wanna wipe the whole thing and start from scratch

wooden schooner
#

is there a way to get embed image from python code

#

python code with upload html and css and javascript and then run it and output gonna be embed immage

amber moat
#

i don't get it why the css isn't loading in the existing html

#

i've tried changing to absolute path ./

#

this has happened earlier too

#
<link rel="stylesheet" href="./components.css"></link>```
#

and both all the css files are in the same directory

#

here's what i got from console

#

ReferenceError: chrome is not defined

#
Resource URL: file:///D:/Unfinished%20Projects/Visual%20bookmarks%20firefox/reference/vb@yandex.ru/layout/zen/loader.js
Source Map URL: loader.legacy.vb-bundle.js.map```
tired root
#

Run a server, then it will work

#

also, there is no </link>

#

python -m http.server on your directory

#

@amber moat

cloud path
#

guys i'm trying to upload images through flask but when i do the upload, the image doesn't load onto the server but without returning errors

#

is something wrong?

#
def save_picture(form_picture):
    random_hex = secrets.token_hex(8)
    _, f_ext = os.path.splitext(form_picture.filename)
    picture_fn = random_hex + f_ext
    picture_path = os.path.join(app.root_path, 'static/profile_pics', picture_fn)
    form_picture.save(picture_path)

    return picture_fn

@app.route('/account', methods=['GET','POST'])
def account():
    ...
    ...
    form = UpdateAccountForm()
    if form.validate_on_submit():
        if form.picture.data:
            picture_file = save_picture(form.picture.data)
            current_user.image_file = picture_file
        current_user.email = form.email.data
        db.session.commit()
        return redirect(url_for('account'))
    ...
    image_file = url_for('static', filename='profile_pics/' + current_user.image_file)
    return render_template('account.html', form=form, user=us, notifications=notifications, image_file=image_file)
native tide
#

What would be a way to convert user input date to mysql column is there a way to format mysql column to accept just d m Y ?

#

or i guess i cna go with datetime.strptime

amber moat
#

@tired root why do i need a server ?

amber moat
#

@tired root now i'm left with only this error: ReferenceError: chrome is not defined

#

i don't use chrome

#

is there a way i change something

tired root
#

@amber moat Because webstuff is sandboxed and cannot access the filesystem, that is the gist of it

#

A webserver serves the files needed

amber moat
#

it seems so i was just now reading about it on SO

tired root
#

I don't know where that error comes from, so cannot say anything about it

#

Probably some js library

amber moat
#

after creating a server is there any thing i need to do ?

#

yes it's in the js library

tired root
#

No, there is nothing you need to do. python -m http.server is only for pure html/js/css files though

#

If you are doing django or flask, they have built-in debug servers

#

however, that wouldn't fix the js error

#

need to look into the docs there

amber moat
#

like on SO an additional thing was mentioned Everything on there will be allowed to be got. Example: background: url('http://localhost:8080/waw.png');

tired root
#

This is going to suck when you go live

#

as you need to exchange the URI then

#

keep that in mind

amber moat
#

i didn't even get it though

tired root
#

or use /etc/hosts to resolve the future url with 127.0.0.1

#

what are you not getting?

amber moat
#

the additional thing which i just now mentioned

#

anyways leave it

tired root
#

It's css

#

It tells css to get that image from that url and use it as a background

amber moat
#

that's alright it's an example. i thought i had to do something like 'http://localhost:8080/new.html' everytime to make it go through the server set up...

#

i'm completely new to this

tired root
#

Yeah, I think you are mixing up a few things here

native tide
#

any1 here with django i needed some help

amber moat
#

what if i use a chromium based browser for a dirty fix ?

tired root
#

@amber moat That won't solve the issue

#

The chrome variable is available on firefox as well

amber moat
#

i'm using brave i think it's chromium based if im not wrong

tired root
#

chrome returns a callback, browser a promise

amber moat
#

a promise ?

tired root
#

yes

amber moat
#

need to look up terminology lol

tired root
#

What library is throwing that error?

amber moat
#

just a second

#

ui.js

native tide
#

I want help with submitting a image and then displaying it on a page dynamically (not using admin panel) in django

amber moat
#

i'm digging inside an extension

solar hatch
#

django project ideas

tired root
#

Yeah thought it is an extension

amber moat
#

wow

tired root
#

I don't think you can run this with a simple web server

#

I would need to look at extension programming to say more, can't really help there

native tide
#

@solar hatch r u saying to me?

solar hatch
#

??

amber moat
#

can i attach the .xpi file ?

tired root
#

you need to debug the xpi file in the browser while sideloading it

#

it's not webdev as such, it's a whole different world

amber moat
#

what exactly ?

tired root
#

extension development

amber moat
#

my actual idea is to create a visual bookmarks extension

tired root
#

Look at the link I gave you, it's a howto on extension development

#

never done it, can't really help with it

amber moat
#

ok i'll take a look

#

i have a similar issue with vivaldi too

#

vivaldi's files are all html and css (it's an electron app) and the html doesn't load css or js when opened in an external browser

#

and shows up errors

#

Not allowed to load local resource: chrome://vivaldi-data/css-mods/css

#

DevTools failed to load SourceMap: Could not load content for chrome-extension://odbfpeeihdkbihmopkbjmoonfanlbfcl/sourcemaps/contentscript.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

#

i think it's trying to access an extension

harsh flare
#

In flask, how do I return a template to a specific container?

#

Like I would with an href? <a href="#property">

tired root
#

That is an anchor, it would scroll to the location where the anchor is defined

#

@harsh flare

harsh flare
#

so if I'm doing ```@app.route("/form", methods=["GET", "POST"])
def my_form():
some_stuff...
return render_template('contact_submitted.html')

#

How do I get the template I've returned to scroll to that anchor?

tired root
#

I don't understand the question. An anchor is something that is present in the html

#

It has nothing to do with flask

#

you need to explain what you want to achieve

#

Do you want to load dynamic content or what is the goal here?

harsh flare
#

So the function is meant to return a template where the contact section has been changed to "Thank for you submitting your enquiry" in place of the form. However the template returns to the top of the page, and I want it to load to the contact section

rigid laurel
tired root
#

use a redirect, not render_template

#

then you can also use a simple anchor actually

#

So, whatever handles the contact form, needs to return redirect("/contact#submitted") for example

#

It's a bit confusing, I'd need to see how the routes are set up

harsh flare
#

You mean set up a route to the contact_submitted.html as @app.route("/contact") def contact(): return render_template('contact_submitted.html')

then for the form set up

def my_form():
        some_stuff...
    return redirect('/contact#contact') ```
tired root
#

yes, for example, then you just need to include the submitted thank you message with js or so

harsh flare
#

^ it worked

tired root
#

Many ways to do this kind of thing though

harsh flare
#

Probably not the most efficient eh! The contact_submitted.html is just the same as index.html but I turned the contact form into a <h3> that says "Thank you for your enquiry...."

tired root
#

I mean, you can also run the route with javascript via xhr and insert the message after it was completed successfully

#

then there is no visible reload

harsh flare
#

yeah thats what I'd prefer really...you got a link to a tutorial on that?

tired root
#

just look how a xhr request works and make a route that returns some json if it was successful or not

#

and make sure to POST the form content

fickle fox
#

hey i am trying to edit post but its not working for some reason

#

anyone knows why?

#
@app.route("/posts/edit/<int:id>", methods=["GET", "POST"])
def edit(id):
    if request.method == "POST":
        post = BlogPost.query.all()
        post.title = request.form['title']
        post.content = request.form['content']
        post.author = request.form['author']
        db.session.commit()
        return redirect('/posts')
    else:
        return render_template('edit.html')```
tired root
#

"is not working" is not an error message and not a traceback

#

but look at your query

#

If that would work, you'd edit all rows of BlogPost

#

maybe you want to actually use that id to update the blog post that is being edited

#

and check if the user has actually permission to do so

fickle fox
#

i didnt yet add permissions so i will probably do it later

#

how would look my query?

#

i mean why should i change

tired root
#

If you cannot answer that question, then maybe you shouldn't be handling databases...

#

again, you are trying to edit all rows in that table

#

There is no where clause based on the id

fickle fox
#

no just one

#

i will take a deeper look

tired root
#

so maybe you want to filter_by and use the id

fickle fox
#

so basically i need

#

post=BlogPost.query.get_or_404(id)

#

they say post is undefined

tired root
#

BlogPost.query.filter(BlogPost.id==id).first()

#

id may or may not be right, however you've setup your tables

fickle fox
#

hmm its still not working

fickle fox
#

never mind i fixed it 😄

native tide
#

Anyone to help me out with Sqlalchemy query

#

can someone give me tutorials

#

how to make website

pliant falcon
#

@native tide Yo' this guy have the best free course I have every seen online:

native tide
#

i can host bots/webs all 24/7

#

free

pliant falcon
#

flask and second django

native tide
#

just need how to make

#

bot

pliant falcon
#

I'm sorry I didn't understand what you mean, can you say again?

viral sphinx
#

What’s an alternative Wordpress that works for flask/Django/

#

CMS to be particular

tired root
#

At this point I want to warn people from letting some random stranger on the web host their stuff

viral sphinx
#

Scorcher, hey bro, I wanted to know if there are alternatives to WordPress as a headless CMS to manage the database for the web app

#

Flask to be specific

tired root
#

Where does this bullshit come from? Honest question. You are the second person this week to ask how to manage a database with Wordpress

#

Write an admin panel.period

#

Or, use a static site generator, it is more than enough for a blog

quick cargo
#

yeah

#

it doesnt take long to make a system todo that

#

django even has an inbuilt admin panel for managing db data

#

i dont even get why people like wordpress

tired root
#

My blog is updated by sending a markdown file into a git repo, which sits on my raspi in a cabinet in my living room. It then syncs the output to my webhost.

quick cargo
#

nice

tired root
#

You can have the same for free with github pages

#

I just implemented that myself @ home

quick cargo
#

is it just waiting for a commit then to the repo then get the file?

tired root
#

I am using Ruby Jekyll

quick cargo
#

fairs

tired root
#

The git has a post-receive hook, which starts a script building my web using Jekyll

#

then I connect via rsync to my webhoster and upload the differences

#
bundler exec jekyll build --verbose --trace
rsync -aP -e ssh /home/user/$PROJECT/_site/ $REMOTE:html --delete``` that is all the magic
#

No database to maintain, no attack vector and no bullshit. The last part is the most important for me.

#

No broken plugins, no hacking templates

quick cargo
#

pretty nice

tired root
#

Fuck Wordpress with an anchor

quick cargo
#

i dont see the use with wordpress

somber wedge
#

Hello guys.

rustic pebble
#

CMS is so bad

somber wedge
#

I am getting circular import errors in flask and sqlalchemy

tired root
#

!imports

rustic pebble
#

@somber wedge You are probably importing things from the main app in another file right?

somber wedge
rustic pebble
#

Yes that is circular import

#

You can do this though:

somber wedge
#

But that is how the tutorial says and it worked last night too.

tired root
#
from flask_sqlalchemy import SQLAlchemy

# Create SQLAlchemy
my_db= SQLAlchemy()
``` put this into an extra file
#

the folder should be at the lowest hirarchy

rustic pebble
#
#this is models.py file
db = SQLAlchemy()
#define classes here
#this is app.py
with app.app_context():
    db.create_all()
tired root
#
from file_youve_put_this_in import my_db as database
# Initialize ORM
database.init_app(frontend)
with app.app_context():
    database.create_all()```Put this in your app.py
rustic pebble
#

oh yes

#

I forgot the init

somber wedge
#

I'm confused

#

Is there something I can read for details?

#

Like some articles or something

tired root
#

@somber wedge The documentation for flask-sqlalchemy

rustic pebble
#

You create an SQLAlchemy instance and then you need to bind it before your app starts

somber wedge
#

Okay. Thanks. But most of the tutorials for sqlalchemy do it with circular imports.

tired root
#

because most tutorials suck and only copy the introduction code and act like they know stuff

#

It's just stupid clickbait

rustic pebble
#

facts

tired root
#

There are very few websites out there that actually go into detail and teach how to really do it

rustic pebble
#

That is true, docs are not even that bad tbfh

tired root
#

That is why it is important to understand shit and get away from Ctrl-C Ctrl-V

viral sphinx
#

Lol it was actually me from before too scorcher, but look, okay I can make an admin portal, but they want to be able to edit the websites layout as well, that wouldn’t be possible with any other existing CMS right?

#

The whole point is to let a non-developer staffs manage the website after I am done building it for then

#

Them*

somber wedge
#

I prefer reading docs myself. But I was following a bigger tutorial where handling the db is a side task. So I thought there might be some quick stuff I could learn. But thanks for the help, I'll look into the docs.

tired root
#

@viral sphinx You can make an editor using a drag and drop library for js, but at this point they should just use wordpress then

somber wedge
#

Btw is there something I should learn before learning sqlalchemy? I only have knowledge of handling db from command line with manual sql or in sqldeveloper. But I've never created integrated apps with db. So I don't exactly understand the full concept of sqlalchemy. I understand something like it maps python objects to db tuples programmatically hence automating the db fillup and SQL. But that's all I know.

rustic pebble
#

It also sanitizes input so your db cant get exploited

somber wedge
#

Btw any of you work with heroku

rustic pebble
#

I have worked with it in the past

somber wedge
#

So how much time it takes for a sleeping dyno to wake up? Like if someone is loading the app for first time in a while?

#

Is it within like what you'd call normal load times for websites?

rustic pebble
#

Yes I guess

#

I usually use AWS elastic beanstalk for that, simple and straightforward

somber wedge
#

I'm already running something on beanstalk.

#

So I was looking into the possibility of heroku

rustic pebble
#

Is this a website or an API?

somber wedge
#

API

rustic pebble
#

There is a dedicated API service on AWS

somber wedge
#

This is a backend that will be used with a front-end

rustic pebble
#

Then it is not an API

#

lol

somber wedge
#

It kinda works like an api, only sending json.

#

Everything else happens in the front-end.

rustic pebble
#

Alright

#

But it is still a website

somber wedge
#

Yes

#

Is there a vscode autocomplete for flask templates?

tired root
#

There is a jinja addon, but it barely works

#

@rustic pebble This is pretty much how vue and others work

#

so...

somber wedge
#

I see

rustic pebble
#

react, vue and angular are not python based though

tired root
#

So? They take a json string from a backend and construct the frontend

rustic pebble
#

Of course

tired root
#

If you do the backend with flask, ruby, php or rust or C++ does not even matter

rustic pebble
#

Well yes

#

But then Node makes it seems effortless especially if you are running on typescript

tired root
#

I take something else over node any day

rustic pebble
#

Why is that?

tired root
#

Because their eco system is insecure and prone to bullshit

#

all the one-liners...

rustic pebble
#

That is not a real answer, it is just your personal opinion about the library

tired root
#

Yes, it is my opinion

#

I am allowed to have one

rustic pebble
#

No one said you aren't

dry raft
#

Does anyone have any suggestions for what sorts of things I should be testing when making a django app? I'm feeling like I don't know which things I should test, and which things don't need tests. For example, if I use the ListView generic and give it the model name/template, where the the template displays an alternate message if no items are found, I'm unsure what needs testing and what just amounts to testing the ListView class. I felt like the alternate message should get a test because it's sort of non-default behavior of my template I'm testing. A test that adds a record and sees that it's displayed doesn't seem necessary though, because that's built in behavior. Are these feelings in the right ball park for what to test in general?

tired root
#

XSS, SQL injections

dry raft
#

Thanks, I'll keep those in mind. What about non-security portions?

tired root
#

well, if the output is what you expect

#

jsonify the data and check it with a unit test

#

Here is a small snippet:

import re 

class Minify:

    def __init__(self, text: bytes, remove_linebreak: bool):
        self.text = text
        self.regex = "[>]\\s{2,}[<]"

        # First step: remove line breaks
        if remove_linebreak:
            self.text = text.replace(b'\n', b"").replace(b'\r', b"")

    def run(self) -> bytearray:
        new_html = bytearray()
        matches = re.finditer(self.regex.encode(), self.text, re.MULTILINE)
        pointer = 0
        for each in matches:
            new_html += self.text[pointer:each.start()+1]
            pointer = each.end()-1
        # Add the rest without matches
        new_html += self.text[pointer:]
        return new_html
#

It is minifying the html output

#

not perfect, but small and quick

#

maybe someone finds it useful

molten quarry
#

This is probably going to be over my head, but I'm curious so I figured I'd just ask...

If I rent a dedicated server, can I run a website off it after paying for the domain?

I'm not looking for the best performance, I'm just looking for something that I can use to host web apps when I start building a portfolio. I started learning Django a few days ago and from the little I know about DNS routing, as long as I have a server with an IP to route to then I should be set to run a web app off it.

#

Or am I missing a piece of the puzzle? Like I said, I'm very new to web development, but I'm curious what my path is going to look like.

quasi ridge
#

definitely doable

#

I don't think I installed anything on the box besides python itself, and some packages from pip ... and ... I think nginx

#

but I only installed nginx because I wanted to do TLS; before then I didn't use nginx

tired root
#

@molten quarry Generally, yes

#

If you buy a domain, you probably have DNS covered, make sure the provider has a dns panel where you can edit IPV4 (A) and IPV6 (AAAA) and that they provide reverse zones

#

DNS isn't routing though btw

#

The more challenging part is not getting it hacked

#

Also dedicated root may be a bit too much for that

#

a vps is more than enough

#

but you still have to administrate it and abide by various RFC, such as 1918, CGNAT and APIPA

#

If you want MX, make sure to have SPF records and DKIM dmarcs

#

Otherwise your mails are going nowhere

#

@quasi ridge Apache is perfectly fine for TLS, so I don't get it, Apache also comes with native Python support

#

If one wants to be extra fancy, I'd use haProxy as Layer 7 reverse proxy, then you can just run Apache and have haProxy handle the requests

quasi ridge
#

well I suppose I could have chosen apache, too; I chose nginx instead

tired root
#

haproxy is a multitude faster than nginx and apache together, but as I said, it's a pure reverse proxy

quasi ridge
#

something tells me that @molten quarry is more interested in ease of setup than speed

tired root
#

Well, ease of setup isn't a concern when you set up a root server facing the public

#

if you want easy, go Heroku paid

quasi ridge
#

not a bad idea

tired root
#

Because people wanting easy is why I get paid a lot of dosh to weed out the ones that got hacked and make sure our part of the internet is safe

#

and the bad guys 😛

quick cargo
#

deploying sites youself isnt gonna be ease of use no matter what you do so you might aswell go the long way and do it properly

quasi ridge
#

we're all just guessing what Fishy's priorities are

quick cargo
#

i gotta sort my ssl cert out tomorrow 😫

tired root
#

On heroku you have at least system security covered and don't get locked because your server is sending RFC1918 into the network or reflecting NTP growth attacks

quasi ridge
#

@quick cargo I've been using letsencrypt with some "client" software called "acme"; I was surprised how easy it was

tired root
#

Certbot is the tool of choice

#

I use it on a cronjob with a public dns

quick cargo
#

Contabo the host im running a vps off atm has zero details on setting up ssl with one of their machines

#

so gonna be a bit of a research task first lol

tired root
#

*tls

#

which server are you using?

#

@quick cargo

quick cargo
#

contabo VPS

tired root
#

no, which webserver software

quick cargo
#

oh

tired root
#

it's just a matter of that

quick cargo
#

im just using nginx and gunicorn atm

tired root
#

then nginx needs to supply the certificate

quick cargo
#

how can i set that up?

tired root
#

  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  server_name example.com;
  root /var/www/example.com/public;

  ssl_certificate /path/to/your/certificate.crt;
  ssl_certificate_key /path/to/your/private.key;

  ssl_protocols TLSv1.2 TLSv1.3;

}```
#

apt install certbot or so should install the let's encrypt certbot

#

run certbot with either the acme challenge (webserver based) or a dns challenge

#

certify the challenge and certbot will create the certs

#

then add a cronjob to update the certs all 2 months

quick cargo
#

alright

#

i shall give this a go

tired root
#

it's really simple if you know your way around Linux

#

also make sure to redirect all requests to http to https

quick cargo
#

yeah ofc

tired root
#
    listen 80;
    server_name linuxize.com www.linuxize.com;
    return 301 https://linuxize.com$request_uri;
}```
molten quarry
#

I don't know what I want. At the moment, I'm not knowledgeable enough to know the difference. More than anything, I just wanted to confirm that an el-Cheapo server could run a website. I thought I might have to get something special aside from a server and a domain name.

pliant falcon
#

Anyone knows a good way to autoreply by email to a person who just submited contact form on my flask website?

#

WTF have this?

molten quarry
#

I was just planning to get a $10 server from OneProvider and launch something revolutionary.

quick cargo
#

yh small sites arnt rlly load instensive

zealous siren
#

the databases are generally more intensive then website

lament mason
outer apex
#

@lament mason I'd suggest commenting out the try except for now and have print(story) and seeing what you're getting for the story path.

#

Looking at the logs, it's getting /the_example and then /favicon.ico, which is probably not in your json file

lament mason
#

it always get /favicon.ico

#

I already tried the print thing, flask skipped it to the return