#web-development

2 messages · Page 124 of 1

quick bay
#

Yup

#

Or locations.location

#

Its the same thing

#

I have tried the following as well, but it hasnt solved it:
choices=((1, 'London'), (2, 'Plymouth'), (3, 'Swansea'), (4, 'Birmingham'), (5, 'Manchester'), (6, 'Edinburgh'), (7, 'Belfast'))

frosty stirrup
#

"

astral river
#

Hi there

#

I just wanted to know if a request take long, are variables lost in flask?

native tide
#

@quick bay when you used the pasted choices above, were you still using ModelForm for your form?

broken abyss
#

Hello!

#

Quick question about Django apps. I've just create app using ./manage.py startapp tasks apps/tasks so I can gather all application in apps folder. But I don't know how to add it now to installed app

wicked elbow
#

So i just thought id step in here and say web development these days is insane compared to wat it used to be... im using react, redux, REST, and DJANGO for my project. I dont remember js/php ever being this intense do do simple things. But it is what it is to have interactive parts of the website. Also you guys in here are all nuts. Said with love of course.

native tide
#

BEST?

mortal mango
#

I didn't set an admin username or password in my django app but the admin page is asking for my username and password. So, I can't sign into the admin page. How do I fix this?

floral vault
wicked elbow
native tide
#

how can i make links for my images using flask?

#

we're talking about 1000+ images so gyazo/sharex/etc aint a option

gaunt marlin
#

you can get url from response_body

#

oEmbed is really interesting as it provide embedded link

native tide
#

i mean

#

im not uploading 1000 images to gyazo

#

@gaunt marlin

simple meadow
#

Hi

#

I need help with flask

#

I have a post request method that get some text fields and file fields from a form and with that it creates a new .exe file

#

I would like to return this .exe file as a response in this post request

#

And then the user would be able to download it back from the front end

gaunt marlin
brittle basin
#

bro what should i prefer to learn btweeen these two,mongoDB and Mysql?

hybrid bobcat
#

MySql better

brittle basin
#

okay so i should say mongodb fuck off right?

near bison
#

If i replicate someone else's cookie. will the server sent me data meant for them ?

#

I am positive the answer is a no.

#

How does server then verify that it's a different person

#

?

gaunt marlin
#

@near bison cookies are hard to get stolen because most browser has protection for it, also if you using ssl the cookies are encrypted so good luck decrypting it before the session is done. Cookies stolen are also called Session Hijacking you can read about it here https://en.wikipedia.org/wiki/Session_hijacking

In computer science, session hijacking, sometimes also known as cookie hijacking is the exploitation of a valid computer session—sometimes also called a session key—to gain unauthorized access to information or services in a computer system. In particular, it is used to refer to the theft of a magic cookie used to authenticate a user to a remote...

near bison
gaunt marlin
#

i'm not referring to you, i just say possibility of it

near bison
#

Okay lol Thank you

native tide
#

Can't you just change your cookie, bruteforcing it until you get some sort of valid key?

gaunt marlin
#

most of us don't work with encryption

covert kernel
gaunt marlin
covert kernel
#

not the site

#

the django site

#

the code for django

gaunt marlin
#

@covert kernel in your settings.py it's development or production environment? (tell by DEBUG=True or False)

gaunt marlin
#

@covert kernel open development console with f12 on browser check console and print out the error so we can see which path not working

#

have you tried running the django project after you forked it to see if the css breaking? i see a commit of you adding donation app

paper void
#

Guys can someone help me with flask it won't show images i have the static folder and everything set up? pls help

native tide
paper void
#

figured it out sorry @native tide

native tide
twilit needle
#

can someone pls help me here?

#

thanks a lot!

obtuse elm
#

can anyone help me with django development?

#

I am working with django channels to create realtime chat app

#

I am connecting to web socket from my react frontend. What I am currently doing is that when a user tries to connect to socket, after passing the authentication process, the connect method of WebSocketConsumer extract all thevhroups of users from the DB and add that user to all his groups (redis channel layers).
Can anyone suggest some optimal way that how can I determine which of that layer received the message and broadcast that message to that specific layer. If anyone has any other way of doing this, it will be highly appreciated.

Thanks :logo_django2:

native monolith
#

can flask display images from different place than static folder?

gleaming spire
#

Hi, any idea why am I getting a jinja2.exceptions.TemplateNotFound: giveaway.html error? (Using flask)
Code:

from flask import Flask, redirect, url_for, render_template, request
    
app = Flask(__name__)
@app.route('/test/<start>/<stop>')
def giveaway(start, stop):
    return render_template("giveaway.html")

if __name__ == '__main__':
    app.run(debug=True, host='localhost', port=2000)
native monolith
#

jinja2.exceptions.TemplateNotFound

#

where is your template?

#

@gleaming spire

gleaming spire
#

Oh wait

#

I forgot to put the html file into the templates folder

#

However

#

My fonts aren't working correctly when I use flask

#

I'm using css and html and rendering the html template with flask

native monolith
#

how did you set up fonts in css?

#

you have to put them in static folder

gleaming spire
#

desktop > main.py and templates folder and in templates, style.css and html files

#

hold up

native monolith
#

you need static

gleaming spire
#

oh okay

#

I'll add a folder named static

native monolith
#
@font-face {
  font-family: 'OpenSans-Bold';
  font-style: normal;
  font-weight: 800;
  src: url('../fonts/OpenSans-Bold.ttf') format('truetype');
}
gleaming spire
#

Would that go into my css file

native monolith
#

depending on where you put css

gleaming spire
native monolith
#

I gave you solution

#

what else you want

gleaming spire
#

Thanks!

paper void
#

I still need help with flask 😭

#

i made a website using a software i have all its files i changed the directories such that it gets the css and images from static

#

it works when i open it as html

#

but flask won't show images or css designs

native tide
paper void
#

yup you can do this in python pretty simple

native tide
#


largest = None
smallest = None

while True:

    num = input("Enter a number: ")

    if num == "done" :
        break
    elif num<str(smallest) :
        smallest=num

    elif num>str(largest):
        largest=num

    print(num)

print("Maximum is", largest)
print("Minimum is", smallest)
#

@native tide

#

whats the traceback

#

Oh and for the last two printing things I suggest using a f string

paper void
native tide
#

@native tide Comparison operators such as < & > are not on str, only numbers

paper void
#

yup

#

use int instead

paper void
native tide
#

and I need also to see if i enter a number

#

i use try .... except , right ?

paper void
#

yup

native tide
#

Or you can check if it's a digit by using if num.is_digit():

paper void
native tide
#

Yeah, just went a bit off aha, my bad

#
largest = None
smallest = None

while True:
    num = input("Enter a number: ")
    try:

        if num == "done" :
            break
        elif num<int(smallest) :
            smallest=num
        elif num>int(largest):
            largest=num
        print(num)
    except : print("Number is Not valid ")

print("Maximum is", largest)
print("Minimum is", smallest)
#

i didn't succeed , although it looks logic for me !!!

lavish prismBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

native tide
paper void
#

use the try ad except before

#

wait

native tide
#

hi. i just finished a website using html and flask

paper void
paper void
# native tide Nope , but it's not logic !!

largest=" "
smallest=" "
n=0
numbers=[]
while True:
        num = input()
        try:
                num = int(num)
                numbers.append(num)
                n=n+1
        except:
                if num == "done":
                        numbers.sort()
                        print(numbers)
                        print("Max number is "+str(numbers[0]))
                        print("least number is "+str(numbers[n-1]))
                else:
                        print("enter a number")```
#

review this code and find your mistakes @native tide

#

hey @native tide will you pls pls help me

native tide
#

ok i can help

frigid hare
#

i feel accomplished for getting django up quickly lol

native tide
#

ah yes

paper void
#

guys firstly tell me

native tide
#

dude i ran djiango and flask But both require webdev skills , what is the point of using Python with them?

#

i mean using python with html/css and so on

paper void
#

does the {{url_for('static', filename='background7.png')} also fetch files which are ins static but inside a sub folder

paper void
native tide
#

so Basically
Html caintains CSS
and Python contain html ?

#

i mean it is Ok But Im not too good at webdev and i thought with Python i can take a shortcut But seems impossible

paper void
native tide
#

bruh Im already giving up lol

paper void
#

i finished the whole backend in 15 mins T_T and i am stuck on the front end for about 3 days now and i havent figures out shit yet

native tide
#

i feel like i just make it harder for myself

paper void
#

backend is of course python

paper void
frigid hare
#

lol dont give up - regroup and find a better way

native tide
#

is there a good way to do it?

frigid hare
#
  • shrug *
paper void
frigid hare
#

i actually ditched flask and got django up in 20 mins on my vps with no sleep

native tide
#

wow nice

paper void
frigid hare
#

but i have no clue what im doing tbh hah just messin around

paper void
#

i can't even mess around properly with flask that's my PROBLEM

frigid hare
#

so far django make sense and seems pretty powerful

#

im just making a small web app to help make life easy at work

native tide
#

wow nice

paper void
#

flask made complete sense was pretty easy very cool i loved it until it won't show my images and css files and i cant configure it

native tide
#

maybe linking error

frigid hare
#

o_O

native tide
#

in flask

#

linking is different

#

than usual

#

Oh well thats all my progress is at :c

swift sky
#

pretty basic question but

#

how does one use an insert statement, using flask sqlalchemy

#

like how does the orm know which column to add the values to

azure flax
#

Hello everyone, i am facing a problem with django, can i ask you for some help please

lean lodge
#

sure

azure flax
#

can i share some screens to explain my problem or some of my code ?

#

well i am working on a mobile app (in flutter) but for the admin panel i decided to make it in django (so i can learn more about this framework since i already code in python) but i can't do a feature with TabularInline so i decided to make a small new project to experience some of my code and i still face a problem, here is my code in screens (just admin.py and models.py)

#

but when i try to add a new question, it works correctly only if i don't add an answer too, and when i try to add an answer i got this error (it doesn't get the question)

#

and when i try to register a question with some answers, i got this error

#

sorry?

gleaming spire
#

<h1><p style="font-family: 'Comic Sans MS"; color:Blue>40 days</p></h1>, only the font works, not the color, any idea why?

astral river
#

Hi can anyone help me with flask

vernal furnace
#

@gleaming spire

 <h1><p style="color:blue; font-family: 'Comic Sans MS' ">40 days</p>

I think you need to put the colour before the font

#

@astral river I don't know flask, but post your problem and when people will see it they will help

gleaming spire
#

Oh

astral river
#

Actually I am making a machine learning application using flask for backend

gleaming spire
#

Oh true

#

Thank you so much!

vernal furnace
#

Np

astral river
#

But if the process takes too long I get an empty response

#

get_transfer_image:1 Failed to load resource: net::ERR_EMPTY_RESPONSE

#

This error to be exact

#

When the process does not take too long (I set the number of iterations to a lower value) it works fine

lethal cedar
#

Can I just use another database with setting up another one in the settings and then call databases = {'other'} in the views file?

lavish prismBOT
#

Hey @native monolith!

It looks like you tried to attach file type(s) that we do not allow (.log). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.

Feel free to ask in #community-meta if you think this is a mistake.

native monolith
#

😕

#

no txt? no log?

#

why is that, I have to send csv? 😄

lavish prismBOT
#

Hey @native monolith!

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

native monolith
#

Okey, once more, I got this weird endpoints, that somebody tried to check. Is it more likely to be human? or I got some bot crawling on my page?
I wonder if this is single guy trying, or there is more of them :'D, error is always 404 no matter what they are trying to do.
good I have only deploy key stored and not passwords there ^^
https://pastecode.io/s/Ppphyh65Ea

twilit needle
#

can someone pls help me here?

twilit needle
#

I've also added important information which I failed to fill-out earlier.

native tide
#

I have tried everything but using gunicorn to run web app of flask is somehow not printing anything! I tried buffered output flushing and all

#

also launching my app through wsgi.py works fine but through gunicorn wsgi:app it does something weird

#

or it is intentional, i don't know but i can't figure out what

dawn heath
warm igloo
ebon obsidian
#

I want to make a pwa for a program im trying to make, so my app has a python backend which im almost done with, i wanna know which i should use for frontend react or vue

native monolith
#

for .gitignore?

halcyon lion
#

boys can anyone who use vs code share his settings

#
{"emmet.includeLanguages": {
    "javascript": "javascriptreact",
    "vue-html": "html",
    "razor": "html",
    "plaintext": "jade",
}
}
#

this is for the inbuild emmet and it seems to not work

hard cargo
#

It seems really weird

warm igloo
# native monolith really? 🤔

Pardon?

Saw your logs. Lots of weird url hits yeah? 404ing?

Yes they’d scan for .gitignore to see if you published a whole repo. Then if they saw that the might start looking for other files containing secrets or other compromising files.

native monolith
marsh haven
hard cargo
#

And why can't I nest through it

simple meadow
#

Hi

#

I need help here

#

Id need to use the value set to the variable outputFileName in another api method

#

How could I do it? Declaring it as a global variable?

native tide
#

yep global var

warm igloo
# native monolith exactly! these are not good crawlers 😄, but I got only deploykey for pulling st...

I don’t think you understand. They’re not really crawling cause they don’t know what you have to crawl. That’s the point. They’re poking you to see if they can find something they KNOW is related to something exploitable. So they’re not bad. They’re casting a wide net looking for things that might not even possibly be on your server. Automatically. They’re probably scanning thousands of servers at a time. This will happen to pretty much anything you expose online.

native monolith
#

not harmful? 🤔 ok

regal scarab
#

Hey sorry may I ask a quick web scraping question here? 😄

buoyant musk
#

Don't know where to put this.https://www.youtube.com/watch?v=Ksq8K-ky-8I

Code and Diagrams at: https://www.elithecomputerguy.com/2020/12/arduino-raspberry-pi-web-based-fan-switch/

In this project we are going to use an Arduino to get the room temperature, and be able to turn on a regular house fan. The Arduino sends the temperature value to the Raspberry Pi using the Serial Communication, the Pi’s Python script take...

▶ Play video
azure flax
#

well hello everyone, i am trying to make a visualization of a picture on the admin-panel so i did this commands :
django-admin startproject imagevizualisation
cd imagevizualisation
./manage.py startapp core
then i added the 'core' on my settings, and i configured my database in the settings,
i migrated then with the commands :
./manage.py migrate
./manage.py createsuperuser
./manage.py runserver
after that i have an admin panel clean, and i tried to follow this tutorial so i just copy/past the code in this link
but i still have 2 problems : the first one is in VSC i have an error with as shown on the screen , and the second one is that the image isn't displayed on the screen as shown on the 2nd screen

#

@vernal furnace

vernal furnace
#

@azure flax you problem is in this line of code,

upload_to='post/thumbnail/%Y/%m/%d/'
#

you don't actually have this destination

azure flax
#

well actually the image is saved because in my folder (local) i have the photo saved

#

i guess its a good idea to store data without having it in 2 copys

vernal furnace
#

oh nice

azure flax
#

maybe i have to add some settings on my settings.py to authorize pictures to get plot?

vernal furnace
#

lemme see

azure flax
#

because when i checked the source code, the <img /> is made correctly but it doesn't appear

vernal furnace
#

show me the code you have, not the one in the doc

vernal furnace
#

you don't need core.models just .models since both files are in the same folder right?

azure flax
#

yes but it works fine even with it

vernal furnace
#

yep

#
default='default.jpg'

can you add default.jpg under the same folder

#

make it the same picture, but it NEEDS to be called default.jpg otherwise it will not work

#

under post/thumnail folder add a picture called default jpg

#

and your imagefield should be like this

models.ImageField(default='default.jpg', upload_to='your destination')
#

@azure flax

azure flax
#

well i didn't understand correctly

#

what ihave to do

#

i've*

vernal furnace
#

look, forget everything I said,

azure flax
#

okay

vernal furnace
#

rename your post/thumbnail folder to something like media

#

now go to settings.py and import os at the beginning of the file

azure flax
vernal furnace
#

if u are using visual studio right click on the folder

#

at the bottom there's rename option

azure flax
#

but i have to configure something with MEDIA = ..

#

non?

vernal furnace
#

yes, do u did what I said?

azure flax
#

yes but i don't find the configuration of medias in my settings.py

vernal furnace
#

just wait

#

lets do it step by step

azure flax
#

okay thank you

vernal furnace
#

now go to models.py and change your upload_to='media'

#

when u finish type ok

azure flax
#

ok

vernal furnace
azure flax
#

already

vernal furnace
#
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

MEDIA_URL = '/media/'
#

add these under ```python
STATIC_URL = '/static/'

#

last line

azure flax
#

done

vernal furnace
#

see if it works now

azure flax
#

no it doesn't work

vernal furnace
#

same problem?

azure flax
#

yes

vernal furnace
wraith condor
#

i am trying to run flask...i am using the offcicial documentation but it gves me an error...i am trying to run the "minimal aplication" i copied the code and tried to run it via export FLASK_APP=hello.py where hello.py is the name of my webapp in ipyb format (i am using vs studio code with a notebook extension)...it gives me this error:

PS C:\Users\Acer> export FLASK_APP=flask.ipyb
export : The term 'export' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • export FLASK_APP=flask.ipyb
  •   + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
azure flax
vernal furnace
#

before upload_to add default='default.png'

azure flax
#

still doesn't work

vernal furnace
#

do u have a default.png in media?

azure flax
#

yes

#

i put one

#

but still doesn't work

#

so i guess its a configuration problem

lethal cedar
#

I want to move all the auth stuff in django from one database to another is this possible when I just change the default database in settings.py and migrate?

vernal furnace
#

@azure flax I found a solution

azure flax
#

really!

vernal furnace
#
urlpatterns = [

 ........  

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#

add that ```python

  • static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
vernal furnace
#

also,

#

make it like this

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#

so thats how it should look

urlpatterns = [

 ........  

]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#

@azure flax

#

now it must work

#

like it have no reason to not work lol

azure flax
vernal furnace
#

from django.conf import settings
from django.conf.urls.static import static

#

these,

#

import these

azure flax
#

its working!!

#

thank you so much

vernal furnace
#

nice :D!

#

@lethal cedar read this carefully, hope it helps!

lethal cedar
#

Thanks a lot man

vernal furnace
#

Read the answers too, otherwise you will be in a huge trouble 😐

lethal cedar
#

Yeah but I think I wouldn't have deleted the migrations

#

If I only want to move a part of the database I will have to set up two databases and then set the database for every model?

vernal furnace
#

I guess the whole point of moving part of a certain database is to transport it to a new database right?

lethal cedar
#

Yeah

vernal furnace
#
If you don’t want every application to be synchronized onto a particular database, you can define a database router that implements a policy constraining the availability of particular models.
#

So basically this is what you want?

#

@lethal cedar

#

So listen, define a new database under the default one in settings.py

#

if u already done that type ok

lethal cedar
#

Ok

#

Sorry didn't saw your message

#

@vernal furnace

vernal furnace
#

@lethal cedar
now to migrate to a new database first

 manage.py migrate auth --database=databasename
#

set your data base name instead of databasename

#

and now

python manage.py migrate app --database=databasename
#

app, is the app you want to migrate

lethal cedar
#

Hm I got an error on the first command

vernal furnace
#

so you must type the name correctly

#

try the second command

lethal cedar
#

OK that worked

vernal furnace
#

so that's all you needed?

lethal cedar
#

I now need a database router right?

#

Or will this automatically work now?

vernal furnace
#

I guess it will work

#

check it

lethal cedar
#

wait

golden parrot
#

Alright, so i want to do this:

1) Update local files from a git repo
2) Stop a service running my webserver
3) Install requirements.txt inside a venv
4) Start my webserver service

how would i go around doing this? a link to a blog/guide would be appreciated
im running a flask server with gunicorn

#

am on debian

vernal furnace
#

@lethal cedar If u can be faster it would be better because I have to go very soon

lethal cedar
#

Yeah sorry

#

I have it working now I think

#

I had to add a database router though

#

@vernal furnace Thanks a lot

dawn heath
vernal furnace
#

np

azure flax
#

Hello everyone, hope everyone is okay!
I am working on a django project and i am doign the admin panel with django-admin and i was owing to make a custom filter with list_filter but i don't find any example on internet so i would like to ask you if someone did it before (a custom filter instead of the is true or not already available on the list_filter available on the django admin panel) !
thanks to everyone in advance for the help!

wicked elbow
#

Anyone know why npm is recompiling code? Im using --watch it says it is, but it hasnt shown up when looking at it in the browser

native tide
#

@wicked elbow using create-react-app?

wicked elbow
native tide
#

Does anyone here use Flask?

native tide
#

$1 to anyone that can make a super simple web scraper for one website like I litteraly only need it to print one line of text from this website DM me

wicked elbow
#

No such thing as a simple web scraper lmao unless theres an api involved

sturdy willow
#

Is this the discord for django or just all web-apps?

hard cargo
#
import {getHistoricRates} from 'dukascopy-node';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

C:\Users\User\Documents\Programming\Python\Popo>```
#

What's causing the error?

#

Its in javascript btw

#

Code: ```py
// ES6 Import
import {getHistoricRates} from 'dukascopy-node';

// CommonJS
const {getHistoricRates} = require('dukascopy-node');

let instruments = ['FRA.IDX', 'EUS.IDX', 'DEU.IDX', 'FRA.IDX', 'BRENT',
'LIGHT', 'AUDUSD','NZDUSD','AUDJPY','GBPAUD',
'GBPNZD','USDDKK','EURUSD','USDCHF','EURAUD','AUDCHF','EURGBP',
'GBPCHF'];

getHistoricRates({
instrument: 'btcusd',
dates: {
from: '2018-01-01',
to: '2019-01-01'
},
timeframe: 'd1',
format: 'json'
})
.then(data => {
console.log(data);
})
.catch(error => {
console.log('error', error);
});

barren swift
#

Hey. I have a question about react redirecting to a static page 404.html where index.html is in public directory. Basically I have <Route exact path="/404.html"/> and <Redirect to="/404.html"/> as a part of Router tags. When I type a path that doesn't exist. Why does /404.html path or any unknown path loads (index.html content without any component) before I can refresh again to see 404.html content?

#

Also, what is the best way to load 404 page or about page (completely different content ig) without navbar and footer? I already rendered navbar and footer in index.js including < App/> component. Is the method above better?

trim marten
#

any selenium expert here ? please dm me

#

instapy dm bot needed

golden parrot
#

isnt that against ToS now?

trim marten
#

i don't know

#

it was?

golden parrot
#
You must not access Instagram's private API by any other means other than the Instagram application itself.
You must not crawl, scrape, or otherwise cache any content from Instagram including but not limited to user profiles and photos.
#

@trim marten

#

i think a dm bot would count as scraping

#

and maybe crawling depending on context

sick tusk
minor pumice
#

Hey guys can anyone give django project ideas??

native tide
#

@barren swift Router renders a React component when you visit that route. You can't try to render a whole html page when you visit that route, because you're then trying to implement server-side-rendering which is a backend task.

So, you need to create a component for your 404 page, and have the paths as URLs not files.

native tide
#
<Router>
  <Switch>
    <Route exact path="/404">
      <404Component />
    </Route>
    <Route exact path="/">
      <LandingPageComponent />
    </Route>
  </Switch>
</Router>

Then use your redirect to go to /404 to render the 404 component, on index.html

native tide
#

how can I convert JSON file to make it use as a table in Django ORM?

#

@native tide are you making a request to your backend, with data in JSON format?

#

nope

azure flax
#

Hello everyone, hope everyone is okay!
I am working on a django project and i am doign the admin panel with django-admin and i was owing to make a custom filter with list_filter but i don't find any example on internet so i would like to ask you if someone did it before (a custom filter instead of the is true or not already available on the list_filter available on the django admin panel) !
thanks to everyone in advance for the help!

scenic vapor
#

Anyone familliar with stripe billing? How do i add payment methods to invoices?

cedar estuary
#

ı have some problems

#

can anyone help me:

#

?

#

ı just broke up w/ my gf

#

but ı was doın' develope a website

#

that kinda web develope problem i think

#

just help

native tide
#

Hey so, I've started a chat website but I dont really have the brain to work out storing the chat messages when I send the websocket data

fallen spoke
#

How do I make my cookies HTTPONLY? I looked through docs and found

SESSION_COOKIE_HTTPONLY = True 
CSRF_COOKIE_HTTPONLY = True

But I am not sure what classifies as a "session cookie". do cookies set by Response.set_cookie() count as session cookies?

fallen spoke
#

jk you'll find someone better king

haughty turtle
#

Get blogs entries with id 1, 4 and 7

Blog.objects.filter(pk__in=[1,4,7])
can I use a list to look up varies entries in JSONField ?
data__cities__contains='London', )

native tide
#

@fallen spoke I think so, have you checked by making those settings true, then inspecting the cookie set?

fallen spoke
native tide
#

Hmm you may need some sort of plugin to check, I'm not 100% positive. Searching on stack overflow says that a HTTPonly cookie should be like:

mycookie=somevalue; path=/securesite/; Expires=12/12/2010; secure; httpOnly;

mortal imp
#

Hello, im struggling to get elements to line up/stay on the page, while scaling with the page.

upper heart
#

In Django, is it ok to have one rather heavy custom User model (Employee, with cca 20 "columns") or is it better to do light model, for example only Username, name, password, and then have a one-to-one relationship to model Profile?

native tide
#

@upper heart You should (in most cases) use Django's User model, add some custom columns if you need.

upper heart
native tide
#

in terms of coding, it's easier to just have it all in one model, then you can just access the table's column instead of having to traverse foreign keys.

but in terms of performance, I don't know whether splitting it up would give any advantage, you should only probably worry about performance until you notice it.

native tide
#

for some reason I logged into pycharm now python isn't installed neither is any of my dependencies

#

wtf

lone trench
#

Guys what do I need to learn in front-end and back-end web development???????

haughty turtle
lone trench
#

Ok thx you so much

vestal hound
#

I'd say it depends on whether all the columns apply to all possible rows (in this case, each user has a profile)

#

if so, that'd be preferable

#

but otherwise OneToOneFields might be appropriate

#

as for performance...whenever you combine results from multiple tables like that you need joins, which have a cost

#

so in that sense having all the data in one table is generally faster (look up database denormalisation)

#

the tradeoff is decreased data integrity and possible duplication etc.

native tide
#

thanks for the in-depth explanation, does a OneToOneField not require a join?

vestal hound
#

a OneToOneField is just a unique ForeignKey

native tide
#

yeah, so in terms of performance, why wouldn't you just have one table for everything then?

vestal hound
#

I'd say it depends on whether all the columns apply to all possible rows (in this case, each user has a profile)

native tide
#

so if there are columns which don't apply to a lot of possible rows, what would you opt for? A foreignkey?

vestal hound
#

or a OneToOneField

#

depending on the case

#

for example.

#

say you have admin users and normal users

#

and only normal users have profiles

#

one user has one profile, and one profile belongs to one user -> OneToOneField

#

on the other hand, let's say that each user has a Country

#

one user has one country, but one country can belong to multiple users -> ForeignKey

native tide
#

gotcha, thanks for the awesome explanation!

vestal hound
#

yw!

dawn heath
native tide
#

guys I'm getting an error which I don't know how to fix. I visited my IDE today and tried to
python manage.py runserver but it said Python was not installed (neither was Django), so I reinstalled both... Now I get this error:
https://pastebin.com/i8abvSv5

In the body it says that
ModuleNotFoundError: No module named 'rest_framework'

So I'm really confused, I have done pip3 install djangorestframework and the same error occurs...

#

seems like its a virtualenv problem

gaunt marlin
#

@native tide all i see in the errors are rest_framework not found in your python3.9, it doesn't show in any virtualenv folder

#

what do you get when you try to run echo $VIRTUAL_ENV in your terminal? it should show the virtualenv location

native tide
#

the output is $VIRTUAL_ENV

#

so my virtualenv is non-existent?

gaunt marlin
#

maybe type pip3 to see which python version pip3 running just in case

#

if djangorestframework exists in your pipfile and if it showing python3.9 for pip3. Check your django setting INSTALLED_APPS if you missing ,
for example:

INSTALLED_APP = [
 'rest_framework' #<- Need ,
 'django.contrib.contenttypes',
]
native tide
#

I can't find the pipfile

#

it's called Pipfile.lock right?

#

my settings.py has commas

#

it's 2am for me, I'm gonna go to sleep and just git clone my project (I think I .gitignored venv) and I will just remake my venv and reinstall Python. It'll work then, it worked before

gaunt marlin
#

oh right you just installed with pip install instead of a pipfile

violet zealot
#

I am working on a flask project. With stripe payment api integration. Shall I describe about my project in this channel?

livid coral
#

hello, please do someone know how to make a custom filter in django-admin ? i don't find any doc (i am not talking about list_filter) but a custom filter like who took in input 2 values, and returns a dataset where the data satisfy a condition (maybe a data where the value is between the 2 values of the input)! thank you so much for your answers

gaunt marlin
# livid coral hello, please do someone know how to make a custom filter in django-admin ? i do...

if you want to filter by 2 dates range i suggest using this package as it's more supported https://github.com/silentsokolov/django-admin-rangefilter
else if you want to filter integer field you can use this package https://github.com/lukasvinclav/django-admin-numeric-filter

livid coral
#

yes integer filters

#

like for price between X and Y

#

i already found the rangefilter for date

gaunt marlin
#

you can use the second package i mentioned

#

it support integer filter

livid coral
#

oh i will look on it then! thank you so much

rustic yoke
#

Hi, I'm currently trying to import some modules on a Flask server and can't import them even when they are listed on my requirements.txt file

gaunt marlin
rustic yoke
#

No module named 'passlib'

gaunt marlin
#

a full error stacktrace would be more helpful

#

!paste

lavish prismBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

rustic yoke
#

k 1 sec

gaunt marlin
#

are you using python3?

rustic yoke
#

yes

#

3.8 to be exact

gaunt marlin
#

you installed it with pip3 installed right? not pip install

rustic yoke
#

yup

#

kinda new to this moving from JS to python

#

at least for server stuff

gaunt marlin
#

this line

from passlib.hash import pbkdf2_sha256 as sha256

is in users.py which you wrote right?

rustic yoke
#

yes

#

should i copy the file content?

gaunt marlin
#

hmm passlib is not in the base python packages

#

let me test on my machine

#

no need

rustic yoke
#

ok

gaunt marlin
#

it's just import problem

rustic yoke
#

it's also having with tweepy module

#

happening*

gaunt marlin
#

how do you run your file?

#

with python or python3 ?

rustic yoke
#

currently running it with the code runner inside vsCode

#

runs it on the venv

#

but it run's properly with the python3 run.py

#

did not try that

gaunt marlin
#

so it work with python3?

#

yeah because you installed the package to python3.8

#

python3 and pip3 refer to your python3

#

python and pip refer to python2

rustic yoke
#

so it's basically the interpreter vscode is calling on the code runner

#

i think

gaunt marlin
rustic yoke
#

yes changed the interpreter on vscode an now runs

gaunt marlin
#

yeah that

#

python3.8 in your venv virtual enviroment

rustic yoke
#

@gaunt marlin venv should always be on the root of the source code?

gaunt marlin
#

i'm not used to venv so i can't tell

rustic yoke
#

which one is the standard or must used?

#

virtualenv ?

gaunt marlin
#

i mostly use pipenv or poetry for my virtual package manager

#

there a fews but it's your preference which one you want to use

wicked elbow
#

Should i use bootstrap or is it cool to use my own elements with css? With react

gaunt marlin
#

bootstrap is good for people who are not expert with css. I don't know other company but mine prefer to not use it if we already a frontend expert

wicked elbow
#

Every tutorial ive seen shows bootstrap is why im asking

gaunt marlin
#

yeah for backend web dev like me, i have little knowledge on the front end so boostrap is a life saver on some tasks

wicked elbow
civic kiln
#

Anyone good with php i need help 😩 😫

modest hazel
gaunt marlin
#

kinda weird to ask PHP question on a python server XD

lavish prismBOT
#

Hey @civic kiln!

It looks like you tried to attach file type(s) that we do not allow (.php). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.

Feel free to ask in #community-meta if you think this is a mistake.

civic kiln
#

im trying to create a login form where users and admin can login but when i press log in im not redirected to another page but im just staying the login page

#

i can send my code

#

But looks like ill have to dm the code

gaunt marlin
#

no need

#

!paste use this instead

lavish prismBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

native tide
#

I am still out of logic in this scenario: I have a big json file, I want to show data from that file in a webpage and apply pagination. How can I do that in django?

gaunt marlin
#

@civic kiln why you not using <form> for login?

#

how can you send data to the backend?

civic kiln
#

We aren't allowed to use css, js and bootstrap its denied in my assignment brief

gaunt marlin
#

<form> belong to html, not css,js and bootstrap

static blade
#

How do i program web_host by myself in python?please send a tutorial or a guild.

livid coral
#

hello everyone, i just finished doing my admin panel (that works correctly with all the customization i wanted to have) but i would like to add some unit tests, but since i never did this, can someone give me an example where the unit tests are useful for the admin panel for example ? thank you so much (i know what is a unit test, and how to write it, but i don't see what to test exactly since there is no "back" or "front" separated like i did in my first web projects)

heady frigate
#

Hello,

- Im here running python3 src/api.py
- src
  - fonts
    - bla-bla

  - templates
    - main.html

  - api.py```

I got the following structure.
Im trying to display text on my website with the font `bla-bla`. in `api.py`, `main.html` is being rendered inside
```py
@app.route("/")
async def home():
    return await render_template("main.html")```

In `main.html` I access the font like this:
```css
@font-face {
    font-family: bla-bla;
    src: url('src/fonts/bla-bla'); 
    font-weight: bold;
}```

But it somehow the text on the page isn't being displayed with that font
graceful elbow
#

I have a django database which consists in this:

class Image(models.Model):
    url = models.CharField(max_length=200)
    description = models.TextField(default=' ')    
#

I want to pass both things to a view i want the image to be random and i want to put the url in the image tag in the html

#

I want to do this:

<img src="{{image}}" alt="">
#

but the image doesn't load

#

the code of the view:

def home(request):
    ls = [i for i in Image.objects.all()]
    r = random.randint(0,len(ls)-1)
    context = {
        'image' :f"<img src = {ls[r].url}>",
        'description' : ls[r].description
    }
violet zealot
#

I am working on a flask project. With stripe payment api integration. I successfully create payment system for fixed price product but I need more advance option.

#

We basically build a payment system in our web app. We are using FLASK for the backend. Generally main idea is when a user come to our site and choose a product and then they will pay us through their stripe account. We need to fetch the amount for that particular product from our business stripe account. When the click "subscribe" or "pay" button they will automatically redirect in stripe billing fork and see the amount of that product what they selected. Then they just enter their card number and click pay. Wala! hugging. They paid me for my product

#

This is the idea for fixed price.

Next idea is if client select products and if that product is fixed price like he want to buy a watch then it's not so complicated because you just call the stripe api and pass the product data through it. But suppose you select a plan like an email service that allows you send a email to thousands of your customers at a time. In that case, you need to count the amount how much email they have sent and bill them monthly basis for those particular emails. Unlike you bill your clients $20 or $70 every month.

#

how much they use our services they only need to pay for those. Let's say Client A use 20MB in this month so he need to pay $20 for this ($1 for 1MB). But in the next month Client A use 50MB so he need to pay $50. Rather than billing him $20 every month or only give him fix storage like 100MB, after he use 100MB he will not able to use any data anymore. For example a prepaid card or metered billing

#

My question is I successfully test the fixed price system. But I don't know how to test this metered billing. Have a look in the screen shot. It is for fixed price.

#

Here is my github repo. But didn't pull the code for metered billing. For now I just code for fixed price. I tested meted billing in my local machine.

And stripe docs for metered billing that might help you

haughty turtle
#

It's the same thing, if you have products depending on the number of products is how much you charge, it's up to you to track the email usage going out of your system and make the calculations to then charge them every month and send that statement through stripe @violet zealot

native tide
#

How do i program web_host by myself in python?please send a tutorial or a guild.

#

Can you?

violet zealot
warped harbor
#

Hello is django or flask good for a web app or should i learn to work with a js framework ?

graceful elbow
#

django all the way

#

way more stuff already built

warped harbor
#

oh thanks i don't really like js so i think i'll try django

noble smelt
#

I get an empty query dict, can anyone tell me why?

#

I am using django

noble smelt
#

Same error

mystic wyvern
#

help(: ```
AttributeError :'str' object has no attribute 'get'

#

i want to make a reply post but when i go to sumbit the reply this erorr appears

dawn heath
native tide
#

@noble smelt print(request.data) to see if your frontend is sending anything to that view

livid coral
#

hello everyone, i am having a little problem, django-admin does no longer generate the id (primary key)
if i don't put it in my models, nothing works 😩! and when i try to add :
""" id = models.AutoField(primary_key=True) """ it doesn't work

native tide
#

@dawn heath so, to confirm, do you want to serialize JSON into python, or deserialize (python -> JSON)

#

@livid coral so primary keys are not auto-added to your models? What is the error when you try to do it yourself with the AutoField

noble smelt
livid coral
#

even if it stored in my db (without an id, but only with the _id generated by mongodb)

native tide
#

@noble smelt well, check request.data

#

And for that you need a POST request, you're using a GET request

#

@livid coral did you migrate then makemigrations?

mystic wyvern
#

@native tide the last one who you dont answer him its me(:

native tide
#

@noble smelt when you make a GET request, your parameters are not in the requests body. They're in the URL.

But you can access them with request.GET[key] so somethings not right on the frontend.

Try use axios for your request library. It's much simpler to understand and less lines of code.

Also is_ajax is deprecated

#

@mystic wyvern because you provided 0 information

livid coral
#

i deleted all the pycache, then deleted the db, i created a new one, migrate all the project, and whenever i create a new instance it don't do the primarykey generation, they want me to created manualy

#

i can code a function that do it but i would like to understand what happened and why django doesn't generate it

native tide
#

Strange

livid coral
#

knowing that in that project it was working correctly before, but i changed the models (that's why i deleted all the cache and the db so i have a new models in my migrations)

#

can i ask you please about another issue i am having?

native tide
#

go ahead

vestal hound
#

@dawn heath so, to confirm, do you want to serialize JSON into python, or deserialize (python -> JSON)
@native tide the other way round actually

#

i deleted all the pycache, then deleted the db, i created a new one, migrate all the project, and whenever i create a new instance it don't do the primarykey generation, they want me to created manualy
@livid coral this happens to all models?

#

even new ones?

#

oh thanks i don't really like js so i think i'll try django
@warped harbor you’ll need JS to make your site responsive anyway

neat ember
native tide
#

@vestal hound I disagree that it's the other way around, DRF's Serializer takes a JS object from the request and serializes it into python, no?

vestal hound
dawn heath
# native tide <@518596072122351637> so, to confirm, do you want to serialize JSON into python,...

I will go with serializer way , how can I write the serializer to achieve the following? I am just trying to solve a problem to map the data where it needs to be using a serializer. I Know a serializer, but how do I map the JSON data structure with the PostgreSQL data to keep the same ordering header, technique_id, subtechnique_id? https://gist.github.com/SkyBulk/52ccdab577c94bde399c3b6ae8288208

Gist

GitHub Gist: instantly share code, notes, and snippets.

vestal hound
#

that's deserialisation: the conversion of raw data into complex types.

#

it's not different for DRF.

dawn heath
#

how can I do ? I mean imagine I deserialize or serialize ? how can I push all data belong to?

vestal hound
#

in general, serialised data is what you can send over a connection because it has been reduced to a simple representation

vestal hound
#

good place to start

#

basically a serialiser is a class that turns a model instance into some more primitive format (e.g. JSON string), or vice versa

vestal hound
dawn heath
#

i have my serializer as my model, but i am not getting a good way to properly match where each tactic, technique , subtechnique match to belong to

vestal hound
native tide
#

@vestal hound oh, yeah, I see. I've been "deserializing" all this time when I thought I was serializing

dawn heath
# vestal hound I do not see any serialisers in your code

this is my code for serializer

from rest_framework import serializers
from apps.api.models import Tactic, Technique, Subtechnique

class AttackSerializer(serializers.ModelSerializer):
    class Meta:
        model = `??`
        fields = '__all__'
#

I dont which model to add to

vestal hound
dawn heath
#

or serialize all models one by one

#

yes, I know , but which one? all

#

one serializer per all data stored?

vestal hound
#

one per model

#

you can nest serialisers too

dawn heath
#

I want to perform AttackSerializer(serializer) as my wrapper of all , and keep the rest as class TacticSerializer(serializers.ModelSerializer): etc

elder nest
#

how do I add a favicon using python

#

I have this but I am trying to add a favicon

#
import os
import random
from flask_discord import DiscordOAuth2Session, requires_authorization, Unauthorized
from threading import Thread
from requests_oauthlib import OAuth2Session

app = Flask('')

@app.route('/')
def home():
    return 'Fireball Bot is Online!'

@app.route("/about")
def about():
    return "<h1 style='color: red;'>I'm a red H1 heading!</h1>"

@app.route("/admin")
def admin():
    return redirect(url_for("home"))

@app.route("/invite")
def invite():
    return redirect("httXXXXXXXXXXXXXons=8")

def run():
  app.run(
        host='0.0.0.0',
        port=8080
    )

def keep_alive():
    t = Thread(target=run)
    t.start()```
#

ping me when you respond

elder nest
#

ok I decided I would just use html but here is my home app.route @app.route('/') def home(): return render_template('web/index.html') and here is my directory stuff

#

but I am getting this error

#
jinja2.exceptions.TemplateNotFound: web/index.html``` is there something I have to do to make it a template
gaunt marlin
#

your static path probably wrong

elder nest
gaunt marlin
#

you need to set template_folder path first

elder nest
#

ok do I still do web/index.html or take the web/ out

elder nest
#

ok I had written this html code before but why does on one hoster it looks like this

#

and on another

#

it looks like this

#

@gaunt marlin

gaunt marlin
#

check your css path

elder nest
#

ok

#

well I dont have that in either

gaunt marlin
#

are you copying from some website?

#

css are needed for styling

#

maybe it's in styles folder

native tide
#

Can I create a open web-access URL with python?

#

like just using ip-address instead of a domain name... I guess I do have domain names I could use.

#

I would guess I would need to use an NGINX or apache web-server

#

What I want to do is create a one time use web-page, log time-zone and user-agent of user, and trash it.

#

For a time-zone discord bot

gaunt marlin
#

i think that related to more how you config the load balancer

heady fox
#

check out if you are a beginner web developer

gaunt marlin
#

kinda hesitance to click random link on the internet :/

dire steeple
#

i need a little help here.I am working on Django food ordering system with a Ml model.To make it work i want retrieve the field value from the database which i am unable to.I once did but its type is Query i want it to be int. Basically i want to store the field value into a variable(type int) in Django and pass it in a function

#

A help will be appreciated

lone trench
#

Guys why web development is famous I cannot find any web ideas???

cold pendant
#

Hey everyone - I’m getting ready to start my first django project and was looking for some guidance. The main app of the website is going to allow users to specify several parameters that will then be consumed on a schedule to run a job. What is the best way to do this? Does django have some sort of multi threaded processing queue built in? ...Should I be looking into async? Want to make sure the server doesn’t get locked up when it’s running these jobs and users can still access different parts of the website. Thanks in advance!

heady fox
#

hello, i have a question for someone who has experiences on domains. So i have a little website and i don't have an SSL certificate yet. When i invite people to my website, they seem not to stay longer than 10 seconds. I'm guessing the reason for that is the SSL Certificate. I'm planning to buy it soon. In my provider, i'm given 3 options for SSL certificate. One is called Standard SSL (attributes: domain ownership validation) also the cheapest one. And other 2 are basically double the first one's price and their attributes are similar which are ownership validation, lock icon in the browser. my question is, which one should i buy in order to make sure that people won't think my website is a scam?

quick cargo
#

low key wouldnt both buying a ssl cert and use cloudflare with strict cert

velvet vale
#

I have the required message. When I open the page it shows but when I submit it disappears. Why?

livid coral
#

well i am reposting it here since i am stucked in it for too long
the auto increment that is included in django isn't working and i don't know what's happening, i installed django-admin and set up an admin panel, my db is in mongodb..
my class in models is :
class Tag(models.Model):
tag_name = models.CharField(max_length=100)

def __str__(self):
    return self.tag_name
class Meta:
    ordering = (["tag_name"])
    db_table = "Tag"

in my admin.py :
@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
list_display = (['id', 'tag_name'])
list_display_links = ('tag_name',)
search_fields = ("tag_name", )
class Meta :
model = Tag

gusty gate
#

HI all,
how do I handle PubSub subscriptions? If I subscribe to a topic I get the seconds till the subscriptions end. Should I save this and generate a Cronjob with resubscribes if the leasing ends or should i just refresh it every day by a cronjob?

native tide
#

!developersverify

native tide
#

hello, I have a huge json with a lot of data that I would like to transform into a website. What could be the best way to do it?

#

json to database and from there a Flask?

#

I dont have any experience in web dev with Python

#

if easier, I also have the data in CSV format

quick cargo
#

CSV is 10000000000% easier

#

because you can use pandas to directly read and process it without nuking your RAM

native tide
#

ok thanks! and with csv i port it to a database and from there I create a flask that outputs that db?

quick cargo
#

would be the easiest yeah

native tide
#

awesome thanks, will try to dig deeper from there

icy fossil
#

Hey all, I'm looking for someone to talk to for a few, if someone's available, about frontend vs backend for authentication implementations. It's been a while since I've done this. Trying to understand the workflow for backend (like, I don't know, there's just a missing piece in my head)

civic kiln
#

can someone help me out

#

thanks in advance!

dawn heath
trim star
#

Hello, the CSRF option for django, is it only applicable for HTTPS?

lusty jasper
#

I'm new and was just wondering if this server has any experience with Django?

wicked elbow
#

ok... i dont understand whats going on... i added ```py
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

when it saves the the db it links to the right spot, but the image wont open. before adding the media root i could view the image in react.js but it says the link `http://127.0.0.1:8000/media` doesnt exist
#

and yes, its uploading the image to that spot fine

vestal hound
#

just ask.

lusty jasper
#

sorry, I'm still kinda new to discord. I'll check those descriptions from now on

vestal hound
#

or do you not need help right now

#

btw it's not a problem, just a reminder

#

welcome!

lusty jasper
#

I posted my full question in the help-argon chat

#

I'm having trouble sorting models with ForeignKey

wicked elbow
#

well alright, upload and display works now. i feel like im getting somewhere in this program now... although this project is a serious task doing all the work by myself from the ground up.

wicked elbow
#

Am i just dumb? How do i sort my queryset in rest api with django?

dawn heath
wicked elbow
# vestal hound in your view?

Eh i figured it out. I did

class ViewSet(viewsets.ModelViewSet):
   queryset= objects.all()
   
   filter_backends = [filters.OrderingFilter]
   ordering_fields = ['id', 'datetime']
   ordering = ['-datetime']
acoustic oyster
#

could someone help me integrate a boostrap in django?

sturdy pike
#

What do you mean? @acoustic oyster

wicked elbow
#

i dont know as much about sql as i thought... or maybe its just django, but how do i make the uid of the post = to the id of the Users table and get the username. i know its with foreign key

violet zealot
summer dirge
# violet zealot In Flask, I found some resource that says I can use bootstrap with a plugin call...

Theres not just flask-bootstrap (Bootstrap 3), but also bootstrap-flask (Bootstrap 4) flask-bs4 (bootstrap 4) and probably some more.

Generally, there is no best practice in this case. Would you rather have a additional dependency, or manage all bootstrap formatting yourself?
The difference is that these flask extensions give you pre-made templates and other things meant to make using bootstrap easier.

violet zealot
vivid spear
#

hello where can i host my flask projects or do i really have to use like aws lambda for serverless functions

gaunt marlin
#

@vivid spear you should host your website on a VPS, any VPS is ok aws is just one of those services

lament nebula
#

Can someone please tell me a cheap way to host a Flask project temporarily?

gaunt marlin
#

@lament nebula you can use heroku hosting, it has free option

#

there plenty of deal on other hosting sites that go for very cheap

lament nebula
#

I was looking at Hostinger, but I couldn't find any documentation for hosting projects/frameworks... 😶

quick cargo
#

just get like a 2$ vps for a month

lament nebula
violet zealot
#

I face some problem when I am practicing flask framework.

when update something in my code, like color or content in my preview (in browser) my content isn't updated. It was still the old one. Why I'm seeing this problem? But when I close my browser and restart the server then my content is updated. Any thoughts any this problem?

halcyon lion
#

boys

#

coming from python i used pycharm and now i am getting into js

#

jetbrains have webstorm as an ide for js

#

are there any limitations compared to vs code

quick cargo
quick cargo
#

the limitation is that webstorm is still as beefy as any other JB IDE and naturally carries the weight of it

violet zealot
hollow torrent
#

how to read a pdf in django

#

I dont want to save it

strong oracle
#

Hi Everybody, I am a N-Tier developer for more than 10 years, now I would like to go with microservice architecture but I dont know where to start. Do you have any recommendations, tutorials or articles?

dawn heath
half mulch
#

I have a flask app with sqlite as database and sqlalchemy as ORM, hosted on heroku.
During development I created an account for testing and then pushed the code with database to Heroku. When hosted I again created some other accounts and after some bug fixes I pushed code from GitHub again and then found that account data of all accounts that was created during the website live has been deleted and again only one account is there , that is the testing account.
It means every time I updated the database got replaced by one on my GitHub.
Why is it happening ?
And is there any way of preventing it.

App link : http://nazninapp.herokuapp.com

My flask run code

if name == 'main' :
db.createall()
app.run()

#

Hope i could post this here ?

violet zealot
#

@quick cargo Problem solved. Just use set FLASK_ENV=development instead of using set FLASK_DEBUG=1. Really it's perfectly working

civic kiln
drifting nexus
#

Flask Security issues

#

anyone available on VC?

dawn heath
#

hey guys , django question, to_representation or overwirte list method?

pine karma
#

How do I download Django?

dawn heath
#

pip

pine karma
#

I tried doing that through the windows command prompt but it kept saying that it didn’t recognize pip

dawn heath
#

install in windows

#

I use linux

pine karma
#

Oh ok thx

topaz widget
rain ledge
#

Django Question (or even general webdev): Anyone know of a good tool for analyzing for why a view might be loading slow (it's making a few external api requests before rendering but i'd like to target the longest requests first)

lofty talon
#

Can you make web games using python

#

that are also multiplayer

#

like an fps or something

#

or is python too slow

pine karma
dawn heath
#

how do I save an array in this model without loop? sector, tactics, techniques, subtechniques = UpdateAttackMapping().populate()
class Tactic(models.Model):
tactic_name = models.CharField(max_length=100)

vestal hound
#

or save an iterable of models?

native tide
#

is there any free webhostings for python sites

#

?

gaunt marlin
native tide
#

k\

#

cause python is my main lang

#

but idk if i should make sites in it or no

#

do you recommend @gaunt marlin

gaunt marlin
native tide
#

should i use django or flask

gaunt marlin
native tide
#

i dont understand what you mean

gaunt marlin
native tide
#

yes thats why im asking

#

🤦‍♂️

#

why else would i be asking these questions lol

gaunt marlin
#

web development is broad, flask and django are just framework to create the backend side of website

#

you use what framework you needed for each situation

native tide
#

hm

#

so i still need to know js, html, css

gaunt marlin
#

yes

native tide
#

k

#

so would i use python for apis and managing user data

#

?

gaunt marlin
#

yes python can do that

#

any web framework languages can do that

native tide
#

and i would not use it for front end

gaunt marlin
#

yeah python not designed for front end

#

backend is the apis and data

native tide
#

ok, thanks for explaining

wicked elbow
#

react is also pushing to the backend these days. as well to make it not so resource dependent front end

frigid yoke
#

Is it possible to embed tkinter into a web browser?

#

Basically, I've build a socket server in python that communicates with a client that runs tkinter. Don't ask why, but now I need to create a http client. Since http can't communicate with tcp (for obvious reasons), I have 3 options: Rebuild the tcp server as a web server, build a proxy, or embed the tkinter (if possible). Since I really don't want to rebuild the entire server, and I also don't have much time, I want to scapegoat my way out by embedding tkinter if that's possible.

#

ok, I think I am going to need to build a proxy -_-

wicked elbow
# vestal hound it is???

yea, read an article on it today... its called rcf if i remember right... allows you to build component on the server and push in pieces decreases the load time of massive pages or something like that. im a noob with react i didnt fully understand everything i read

vestal hound
wicked elbow
#

yea that was mentioned in there. it said something about you can already do it with workarounds, but its becoming built in. or something along those lines. ill see if i can find the article again if you want

vestal hound
#

that sounds like SSR which, to my knowledge, is not currently built into React

wicked elbow
#

yea, SSR is was also mentioned. it was an article that popped up on my google discover so i read it. dont remember all the details because at the time didnt seem super inportant

native tide
#

@wicked elbow, no

wicked elbow
#

yes, seriously though. SSR is already a thing though. and using a node server, you can send static html rendered on the the server and display on the browser. thats ReactDomServer. Its possible the article i read was older too because i see a ton of posts mentioning react SSR. like i said i didnt soak to much of the article up though as im still fairly new to client side frameworks. im used to building static pages or using php to giving the static page.

wicked elbow
#

grr... why is the django server so slow loading the stylesheets. refreshed the page, cleared the cache and the classes still arent showing...

#
.buttonVisible {
    background: #F0F3F4;
    border: thin solid #3a4660;
    transition: border 1s ease, background 1s ease;
}
.buttonHidden {
    background: #FFFFFF;
    border: thin solid #FFFFFF;
    transition: border 1s ease, background 1s ease;
}
``` these arent doing anything, class changes on the element, but doesnt render. it worked before i switched to it class instead of jsx. maybe its an id style, but doesnt show marked out on chrome so idk anymore lmao
swift wren
#

jesus django is massive

#

so much linking

native tide
#

web development is boring

gaunt marlin
#

yes django is very broad, it will take a long time to understand it all

broken ravine
#

Any Django devs in here?

#

Is anyone familiar with Django REST

gaunt marlin
broken ravine
#

So I want to make an OAuth v2 framework for my already-made Django app. Do you have any resources specifically for that

gaunt marlin
#

i like allauth more because it support more services/providers

gaunt marlin
broken ravine
#

oh ok dope

gaunt marlin
#

these alot of tutorial on youtube with allauth for example https://www.youtube.com/watch?v=qqFCt0Yde40&ab_channel=JustDjango

This is the first episode of the Django Package Review series. In this video, I talk about Django Allauth - probably the most well-known package for handling login, registration and social authentication in Django.

https://learn.justdjango.com
☝ Get exclusive courses & become a better Django developer

Follow the code here:
https://github.com/j...

▶ Play video
broken ravine
#

Sweet! Thank you!

twilit needle
#

can someone please help me here?

#

thanks!

wicked elbow
#

anyone know why this is giving me an auth error?

const config = {
    headers : {
        Accept: 'application/json',
        'Content-Type': 'multipart/form-data',
        'Authorization': `Token ${token}`
    }
};
axios
    .post('/api/web/', form_data, config)
gaunt marlin
wicked elbow
#

everything worked correctly until i added authorization into the mix... but hold on

gaunt marlin
wicked elbow
# gaunt marlin please post the api view, we can't find what wrong from the frontend call, maybe...
class PostsViewSet(viewsets.ModelViewSet):
    queryset = Posts.objects.all()
    permission_classes = [
        permissions.IsAuthenticated
    ]
    serializer_class = PostsSerializer
    filter_backends = [filters.OrderingFilter]
    ordering_fields = ['datetime']
    ordering = ['-datetime']

    def post(self, request, *args, **kwargs):
        src = request.data['src']
        uid = request.data['uid']
        Posts.object.create(src=src, uid=uid)
        return HttpResponse({'message': 'Image created'}, status=200)
``` thats the api view
twilit needle
#

how do I check if its the update method which send the signal

gaunt marlin
#

@twilit needle before you doing update with save() add update_fields argument to the save() call

a = YourModel.objects.get(pk=1)
a.field_name = 2
a.save(update_fields=['field_name'])
twilit needle
#

I am working with drf

#

Have a view like this

#
class RoleRetrieveUpdateDestroyView(generics.RetrieveUpdateDestroyAPIView):
    """
    An API view to create, retrieve or destroy roles.
    Doesn't take in the role's position as a parameter, though.
    """
    # make sure that default roles' names as well as colour cannot be changed.

    queryset = api_models.Role.objects.all()
    serializer_class = api_serializers.RoleSerializer
    permission_classes = [IsAuthenticated, ManageRoles]
#
class Role(models.Model):

    class Meta:
        ordering = ['position', 'cluster']
        required_db_features = {
            'supports_deferrable_unique_constraints',
        }
        constraints = [
            models.UniqueConstraint(
                fields=['position', 'cluster'],
                name='deferrable_unique_role_position',
                deferrable=models.Deferrable.DEFERRED
            ),
            models.UniqueConstraint(
                fields=['id', 'cluster'],
                name='relatively_unique_role_id'
            )
        ]

    # cluster and id must both be primary key
    # to make sure the endpoints make sense
    objects = api_managers.RolesManager()
    id = models.BigAutoField(primary_key=True, db_index=True, editable=False, auto_created=True)
    permissions = BitField(flags=permission_flags, default=default_perm_flags, db_index=True)
    position = models.PositiveSmallIntegerField(null=True, blank=True, db_index=True, editable=True)
    name = models.CharField(max_length=100, validators=[MinLengthValidator(2)], db_index=True, default='new role')
    color = ColorField(db_index=True, default='#969696')
    cluster = models.ForeignKey('api_backend.DataSheetsCluster', on_delete=models.CASCADE, editable=False)
    created_at = models.DateTimeField(auto_now=True, editable=False, db_index=True)

    REQUIRED_FIELDS = [name, cluster]
#

and a model like this

#

what I want to make sure is during the update method of the drf view,

#

I dont want the name or color of the role object whose position is NULL to be updated

#

alone

twilit needle
gaunt marlin
wicked elbow
#

@gaunt marlin yea, so all i had to do was switch the spots of the headers... the 'Authorization' header had to go first, then the content-type.... literally makes zero sense, but hey. it is what it is

twilit needle
gaunt marlin
wicked elbow
#

next question though if i set the user-id of the post as a ForeignKey(User) will that let me pull username from the database... i dont understand the models of django very well

gaunt marlin
twilit needle
#

okay so I am doing single update only

#

Can I override the model's save method instead

#

to update

gaunt marlin
#

sure

gaunt marlin
gaunt marlin
#

so you dont need to call instance of the object

wicked elbow
#

alright, so im saving posts with uid=some# but it needs to linked to the username of whatever USER id=? that way if a username is changed down the road, the uid is still the same, but it changes the username on the post if you understand what im saying... is foreignkeys not how you do that?

gaunt marlin
wicked elbow
#

ok so when a person posts, the post will be tagged with their id# passed through state, i need the way to return the username from that id... i suppose i could just querry the user table where id = uid and only return the username, but that still seems dangerous...

gaunt marlin
#

if you print request.user in the view you can see which user instance calling

wicked elbow
#

so say 100 people post on the a forum. each post is tagged with their uid not their username, because usernames change, but user ids dont... if you saved to an old username it wouldnt update to the new username... i need to link the usersnames to the ids on the posts

gaunt marlin
#

ah ok

#

hmmm

#

i still wondering

#

why you not just set user_uid to the post id?

#

you querying user right?

#

shouldn't be anyharm

#

if you just want username from the query use values_list('username'), it only return username from the query(no other info)

wicked elbow
#

yea, but doesnt that take up database resources.... if a 100 unique ids are on posts, id have to querry for each. how do you set up a serializer that accepts 100 ids to return in one output.

#

again why i assumed a link between databases would be better, but again, im not that knowledgeable about django models/serializers

gaunt marlin
#

@wicked elbow actually the user would have manytomany link to a post

#

so you only need to query for the post id

#

and return uid, username of manytomany field in a list

#

it's easier

wicked elbow
#

okay, but how is it setup? for the models and view?

gaunt marlin
#

model post has manytomany to users table, in the view you can have custom serializer method that return all username as a list from querrying post.users.all()

wicked elbow
#

the model would look like user = models.ForeignKey(User, on_delete=models.CASCADE) right? linking user to Users. then in the serializer, i pull username from parent?

gaunt marlin
#

not foreign key

#

but manytomany

wicked elbow
#

ya, i set it up.... the User model has a get_username() method so i can querry for only username. itll also give my trackbacks to posts by user, which will be good for a profile view, querry for all posts by username ect

native tide
vernal furnace
#

@native tide Are u still here?

#

its because you are already in schema

#

importing would make no sense at all

native tide
#

got it!

#

🙂

rapid bramble
#

Hello I've a question regarding Flask

#

Let's say I'm taking requests to an endpoint /node_web

#

I want to catch all sub-requests like GET /node_web/example in the same function, how do I setup that?

#

Mention me if anyone is answering please.

native tide
#

hi
is there a way when using CreateView to save the data from the form only when a certain condition is met?

verbal horizon
#

Hello dear comrades, i need help with cookies

#

for some reason, this line

resp = Flask.make_response(render_template('login.html'))

causes this
TypeError: make_response() missing 1 required positional argument: 'rv'

#

am i doing anything wrong?

#

resp = Flask.make_response(render_template('login.html')) newCookie = generateUUID() resp.set_cookie('uuid', newCookie, expires=(datetime.utcnow() + timedelta(days=7)))

steel kindle
#

flask or django?

#

which ones better

hot kraken
#

It depends

simple copper
#

Is there any repository with DRF messages (django.po) already translated for some languages?

cerulean remnant
#

Nice

native tide
#

@cerulean remnant Thanks, appreciate that.

wicked elbow
#

can i show off my project here?

native tide
#

I wouldn't mind 🙂

#

I have experience with python but not with web development. I was trying to get some insights on resources and frameworks I should aim for as a starter

fallen spoke
#

what does rest_framework.authentication.SessionAuthentication do exactly? do I need it If I am using JWT authentication? I currently have it on because from what I understand it is needed for CSRF. Is that all it does? are there any security issues/ implications of having it on only for CSRF? if I should disable it, what would I use for CSRF?

wicked elbow
#

my current project. react.js/redux/Rest Api/Django. need to learn the models and querysets better if anyone wants to explain them. im literally lost. i know basics of databases, but not linking tables

chrome yew
#

I am looking for the best django free course which is for beginners. I have done python fundamental tutorials and now looking to get into web dev. Plz help me suggest a good django tuturials or course for beginners

native tide
#

I have experience with python but not with web development. I was trying to get some insights on resources and frameworks I should aim for as a starter

wicked elbow
wicked elbow
#

now how in the world is django allowing me to add to the database with an empty value with blank=False?

indigo kettle
#

blank=False is for formfields

#

but unless you have null=False as well, you're still allowed to add null values

wicked elbow
#

ah that makes sense. duh. i mean when you create a table its literally NOT NULL lmao

noble kraken
#

Hello everyone. My name is Michael. I've spent the past 12 years or so bouncing between different trades (military, Chinese translator, business major, English teacher in China). Saved up enough money to study webdev for a year with the goal of becoming employable by the end. Studied a bit of C# over the past few months, and ultimately decided to focus on HTML, CSS, and JS before going any further into other programming languages. My main reason for joining the discord channel is to find a mentor that would be willing to offer some level of direction and clarity over the course of this year. Between family and general life stuff, I have 6-7 hours/day allocated for study and practice purposes. Front-end seems more up my alley for the time being given my goals. Any advice is greatly appreciated and I hope to find more likeminded people here (and hopefully a mid-long term tutor). Thanks for reading this block of text!

#

Apologies if this is the wrong place to post this

untold flare
#

Do gunicorn and other wgsi-compatible web servers invoke the application callable (or other specified callable) upon each refresh? Assuming that is what happens, does a framework like Django then handle that request with all of the given information and send a response back?

surreal horizon
#

Has anyone else had a problem with CSS not updating while using Flask Framework in Python? If so, how can I fix this.?

noble spoke
#

Did you try holding shift while clicking reload?

#

It force reloads all the styles

wicked elbow
#
def get_queryset(self):
    queryset = Posts.objects.all()
    feed = self.request.query_params.get('feed', None)
    if feed is not None:
        queryset = queryset.filter(type=feed)

    return queryset

this isnt filtering for whatever reason heres my axios get

// GET FEED
export const getFeed = () => (dispatch, getState) => {
    axios
        .get('/api/web/?feed=true', tokenConfig(getState))
        .then(res => {
            dispatch({
                type: GET_FEED,
                payload: res.data
            });
        }).catch(err => dispatch(returnErrors(err.response.data, err.response.status)));
};
``` anyone know why?
twilit needle
#

can

#

someone please help me

wicked elbow
#

depends, what do you need? just ask here if i dont know the answer someone else might

twilit needle
#

so I am making a custom model field, that takes the value and decomposes it into binary for storing into a database. Upon retrieval, it reconverts the value from bytes.
I am having the field right now here
https://mystb.in/PublishedAllenFeature.python

but I think this can be better implemented. can someone please help me with this?

wicked elbow
#

thats way over my head, sorry. i cant even get my filter to work passing query strings...

twilit needle
#

okay am waiting for someone who can

wicked elbow
#

wooo i managed to get it to work with a different field

barren swift
#

Can I ask simple express question here? Basically I make an API call and obtain user's ip. Although it's server's ip instead of the user's ip. I'm not sure if it's heroku, but how should I solve this? This is what I have axios.get("https://api64.ipify.org/?format=json") // Get User's IP Address.. Is this because it's in express (server)? Maybe I can make the call in front-end and send this data.

#

It's free. No API key needed btw

vestal hound
#

so I am making a custom model field, that takes the value and decomposes it into binary for storing into a database. Upon retrieval, it reconverts the value from bytes.
I am having the field right now here
https://mystb.in/PublishedAllenFeature.python

but I think this can be better implemented. can someone please help me with this?
@twilit needle better in what way?

hard meadow
#

hi if anyone has used a software called xampp before please let me know. Im confused on what to do if my files dont show up in a list

twilit needle
#

If I want to implement this idea, is this the only way to go?
I want high consistency and speed

wicked elbow
#

Django is ridiculous when it comes to documentation.. rest api isnt much better...

hoary sorrel
#

guys need help... working on a web scraping code with selenium. the website blocks bot action but grants access to manuel input. what can i do?

wicked elbow
#

alright... so react aint working for me... im using componentDidUpdate to requery to change whats showing on my page, but its not rerendering after requerying... shouldnt that be called on prop change

wicked elbow
wicked elbow
# hoary sorrel guys need help... working on a web scraping code with selenium. the website bloc...

this is the web dev comunity. most of us would agree, that if we were paying to run a server, and didnt want bot access, we would hope people didnt try to get around it... comes down to bandwidth and cpu usage... not every site is built for huge pulls of data off the site. even on big sites its normally bandwidth restricted/page refresh from ip restricted to keep people from comsuming all their bandwidth... on a small server it would be similar to a ddos attack.

echo mesa
#

I'm trying to fill a table of Select with data from my database, I saw on the internet I can do something like
form.field.data = newdata
but it's not working, It's throwing an Error
AttributeError: can't set attribute
My code is:
template_form['schedule'].TwoDTable.data = template_previousSchedule
Where
template_form = {'whosTable': whosTable_Form, 'schedule': scheduleTable_Form}
scheduleTable_Form = forms.scheduleTableForm(meta={'csrf' : False})
and

class lessonForm(Form):
    Lesson = SelectField('', choices=args['Lessons'], render_kw={"Class": "lesson"})

class scheduleTableForm(FlaskForm):
    TwoDTable = FieldList(FormField(lessonForm), min_entries=66, max_entries=66)
    changed = HiddenField('changed')
    submitToDB = SubmitField(label='submitToDB', render_kw={'value': 'עדכן'})
#

It seems like the setter is broken ?

echo mesa
#

I've looked at the procces functions but I don't get how to fil lthem

twilit needle
#

thanks a lot!!

#

please ping me when help here or on stack overflow!

#

thanks for sparing your time!

native tide
#

I am using Quart websockets and I want to retrieve all connected clients and broadcast the message sent from one client to the rest

#

please ping with an answer and I will read it later on when im home again

quick cargo
# native tide please ping with an answer and I will read it later on when im home again

We did a similar system design before we moved to a REST api for sending the messages and then only using WS for receiving message, but:

  • We made a 'Room' class that essentially contains all the ws connections (any other info we needed to exist as a global state)
  • the room had a submit function essentially and then a global queue across clients with a waiter going through the events in the queue, (this avoids clients receiving events in different orders, this may or may not be important to you ig)
  • each client was a custom class with a event filter so it was easy for the actual endpoint to call events without being messy so all the endpoint did was client(op_code=x, data=y)

What would be a good idea if you intent for this to be used for many clients and want to scale it to more than one instance, i would recommend using a message emiter and receiver system, something like redis or rabbitMQ so emitting on one process relays to the others aswell, but that'll depend on what you do

vernal furnace
#

Hello guys I need your help regarding the deployment of my first Django app, heres how it looks when I type runserver(offline)

heady zealot
#

Good morning and happy new year. Can someone point me to the correct chan for a py3 json encoding issue ?

vernal furnace
#

and heres how it looks when I deploy it(heroku)

heady zealot
#

nm may have just answered myself

barren drum
#

Could you recommend a course on Figma? That is rather oriented to the use of figma for design itself and web design.

native tide
#

@quick cargo I don't ever ask this but do you have any snippets I can check out. That are related to what you said

ornate shell
#

Hello everyone and happy new years! Hope everyone is having a great time and are healthy. Can someone tell me how much python should i know in order to learn django? Also, what are some good exercises for python beginners

native tide
#

@ornate shell Finish a course on Python and you should be good. I really liked Codecademy because they teach you Python then they guide you through some projects which you can do outside of the course.

#

Then you can focus on some libraries like django.

ornate shell
#

@native tide thanks!

native tide
#

Then if you're liking Django, you can look at other courses such as JS / React / SQL if you want to learn more about the web-dev ecosystem.

#

django or flask !?
which one is the best for building a website (dashboard) for a discord bot
(with a good access and manipulation of the databases)

quick cargo
#

neither

#

go with a asgi framework and server if you intent to run the two in the same process

#

if not then what ever but i personally would still go with asgi because easier to setup websockets for ipc

native tide
#

ok thankx

vestal hound
#

(partially)

#

but yeah

urban burrow
#

Anyone here who can help me with a noob question?

vestal hound
urban burrow
#

How can I change the datatype of one element in a dictionary?

vestal hound
#

and do you mean the key or the value?

urban burrow
#

The value beinig displayed.

#

city_weather = {
'city' : city.name,
'temperature' : r['main']['temp'],
'description' : r['weather'][0]['description'],
'icon' : r['weather'][0]['icon'],
}

#

In this case the temp value

vestal hound
#

or only after you access it?

#

do you know how to modify an element in a dict, in general?

urban burrow
#

I am not really familiar with changing one thing in a dictionary

vestal hound
#

do you know how to add elements to a dict?

urban burrow
#

sure

#

sorry to bother you

vestal hound
dawn heath
tawdry magnet
#

this question is kind of miscellaneous but ill ask it here. my site is both on www.site.com and just site.com. nginx manages that. the problem is it seems that browsers treat them as different sites. cookies, local storage, etc do not transfer between, it doesnt seem impossible to fix this in the frontend side, but its kind of messy. an idea i have at the moment is just make www.site.com redirect to site.com. github seems to do that. is this considered bad practice? are they any concerns or gotchas i should know about doing this?

wicked elbow
#

not a clue, lots of sites have redirects though. including other domains for typos... www.google.co is redirected to www.google.com for instance

wicked elbow
#

god i hate design... spent 20 minutes trying to get something to line up right. and then once its finished, it looks like poop... lmao

wicked elbow
#

anyone know how to make a get querry when database requires an authorization token to access? to querry for username/email onChange for real time verification?

heady zealot
#

anyone up for a quick question ?

#

I cannot seam to get this bytes to decode

toxic flame
#

hi guys

#

happy new year