#web-development

2 messages ยท Page 100 of 1

austere prawn
#

So I should use Wappalyzer for that?

marble carbon
#

yeah

austere prawn
#

hmm

#

so I go to the page, reload it, click on Wappalyzer icon?

marble carbon
#

yep

austere prawn
#

Cart functionality is surprising

#

There are no shopping functions on this site whatsoever

marble carbon
#

is that the timeline page u are trying to automate?

#

coz that's exactly what I saw on the homepage

austere prawn
#

err

#

where did you see timeline?

marble carbon
#

whatever this page is

austere prawn
#

yeah, that's what I'm trying to automate

marble carbon
#

is the wappalyzer analysis for that page?

austere prawn
#

yeah

marble carbon
#

okay

austere prawn
#

Just an educated guess, the code that's managing the posts should be under the "core" directory, right?

marble carbon
#

okay got it

austere prawn
#

Do I just control + F and search for the ID of the notification?

marble carbon
#

ctrl + shift + p

#

without opening any file

#

in sources panel

austere prawn
#

okay

marble carbon
#

type search in panel

#

press enter

#

will open a tab at the bottom, enter ID there and press Enter

austere prawn
#

Alright

#

Thanks

#

let me do that

#

it doesn't look like it's doing anything

marble carbon
#

screenshot

austere prawn
marble carbon
#

that's Ctrl + F

austere prawn
#

Nope

#

Well

#

going to "search in panel" in Ctrl + Shift + P

#

Is the equivalent of Ctrl + F

marble carbon
#

ah

austere prawn
marble carbon
#

it was show search

#

my bad

austere prawn
#

drawer or network?

marble carbon
#

drawer

austere prawn
#

no matches found

marble carbon
#

try "display"

austere prawn
#

let me ensure I'm using the right ID

#

so it should be 1Course-col2-feedPane-newContent, right?

#

without quotes on either side

marble carbon
#

yeah

austere prawn
#

okay, still didn't find anything

#

Putting "display" in the search bar yielded many results

marble carbon
#

try class name maybe

#

not all of them, put them one by one, try all sorts of combinations

austere prawn
#

how do I tell it to prettyprint?

marble carbon
#

idk

austere prawn
#

looking for newContent found this:

marble carbon
#

๐Ÿ˜

#

dont crop too much, I need context for that code

austere prawn
#

Uhhhh

#

this is line 77 thousand in one huge js file

marble carbon
#

include 7 lines present right above this code and 7 lines present right below this code

austere prawn
#

above in terms of structure, or literally 7 lines above this line

marble carbon
#

latter

austere prawn
marble carbon
#

hmm nah

#

this is a utility function

#

can u link me to this script file?

austere prawn
#

how do I do that?

marble carbon
#

hm well

#

it must have a url?

marble carbon
#

hmm wait

#

I told u to do a global search ๐Ÿ‘€, were u only searching within that core engine js file

austere prawn
#

I did a global search

#

At least, for some of the searches

#

_>

marble carbon
#

do it for all

austere prawn
#

for xds-newContent it found one result within the css file

#

engine.min.css

#

but that's design, not actual code

marble carbon
#

ik

austere prawn
#

wait..

#

it takes a while to search this behemoth of a file

marble carbon
#

ofc

#

๐Ÿ˜‘

austere prawn
#

unresponsive...

marble carbon
#

ah well

austere prawn
#

I was searching for "unread"

marble carbon
austere prawn
#

alright

#

thanks

marble carbon
#

โœŒ๏ธ

austere prawn
#

aha, it found stuff for "unread"

#

yay

marble carbon
#

oh okay, try narrowing it down to the class ur looking for

#

idk honestly how looking at js code, might help with the selenium script tho

austere prawn
#

well I need to know which item to check

#

To see if there's a new notification

marble carbon
#

the most you can do is check for click event listeners on those notifications

glad patrol
#

Source map error: Error: request failed with status 404 Resource URL: http://localhost:63342/usb-monitor/gui/assets/vendor/bootstrap/css/bootstrap.min.css Source Map URL: bootstrap.min.css.map

#

hpw to fix this

stable kite
#

this is because you don't have this on it's described location

glad patrol
#

i have

#

in my css folder

stable kite
#

just show where it is located

glad patrol
#

online someone ans this

#

Delete the line /*# sourceMappingURL=bootstrap.css.map */ from bootstrap.css

stable kite
#

this is because you don't have bootstrap.css.map

glad patrol
#

i delete but the result is same

#

ok so i need to donwload .css.map

#

and pasted in css directory?

stable kite
#

it will be okay if you don't have .map file

#

it will work perfectly

glad patrol
#

yes but it throw error in browseer console

stable kite
#

yes it will

glad patrol
#

how to fix

winter spindle
#

heyy

stable kite
#

this is a warning not error

winter spindle
#

can someone tell me from where can i learn django ?

#

like tutorials

glad patrol
#

@stable kite then why it didnt show my result

stable kite
#

@winter spindle django official tutorial & documentation

glad patrol
#

its empty table

stable kite
#

@glad patrol what result?

#

@glad patrol css is used for styleing not for DOM

glad patrol
#

no i write the script

stable kite
#

which script?

glad patrol
#

in my html i use javascript

stable kite
#

just check your javascript

#

or post your js code

glad patrol
#

ok

#
<script>
    function refresh(){
    $(document).ready(function(){
        $.getJSON("data.json", function(data){
            let stats = "";
            $.each(data, function(key, value){
                let name = key;
                status += "<tr><td>"+name+"</td>"
                $.each(value, function(key, value){
                    status += "<td>"+value+"</td>"
                    console.log(value)
                })
            })
            $("#table").append(status)
        })
    })}
    refresh();

</script>```
#
<div class="row">
        <!-- ============================================================== -->
        <!-- data table  -->
        <!-- ============================================================== -->
        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">Genereate Report Of Connected Clients</h5>

                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="example" class="table table-striped table-bordered second" style="width:100%">
                            <thead>
                            <tr>
                                <th>Name</th>
                                <th>IP-Address</th>
                                <th>Status</th>
                                <th>OS</th>
                                <th>Time & Date</th>
                                <th>Total Devices</th>
                            </tr>
                            </thead>
                            <tbody>

                            </tbody>
                            <tfoot>

                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <!-- ============================================================== -->
        <!-- end data table  -->
        <!-- ============================================================== -->
    </div>```
stable kite
#

are you having any data in your data.json?

glad patrol
#

yes

stable kite
#

are you sure?

glad patrol
#

yes

#

as i send my console error

#

you can see ip os status ...

stable kite
#

just try this in your browser console

$.getJSON("data.json", function(data){
            let stats = "";
            console.log(data);
            $.each(data, function(key, value){
                let name = key;
                status += "<tr><td>"+name+"</td>"
                $.each(value, function(key, value){
                    status += "<td>"+value+"</td>"
                    console.log(value)
                })
            })```
#

@glad patrol what it gives you?

glad patrol
#

@stable kite i paste it how to execute it?

stable kite
#

just press enter

glad patrol
#

i pres enter it go to new line

#

lol

stable kite
#

where is your #table in your html

glad patrol
#

oh

#

its #example

#

i think

stable kite
#

yes

#

try it out

glad patrol
#

omg

#

work

#

gg

#

gg

#

but 1 problem

#

it say no data avaible but down it dsiplay ๐Ÿ˜„

stable kite
#

@glad patrol have your problem solved?

glad patrol
#

yes solved but

#

why it display no data availabel

#

even it dsiplay

stable kite
#

because it is hard coded

glad patrol
#

no

#

no hard coded

stable kite
#

@glad patrol just use inspecter to find which html does this

glad patrol
#

ok 1 mint

stable kite
#

just see your ip address &status column

glad patrol
#

hhaahha

#

ya

#

i changed

#

<td colspan="6" class="dataTables_empty" valign="top">No data available in table</td>

#

this is the part

#

but where is this part in my code

stable kite
#

are you using an package for tables?

coral timber
glad patrol
#
 <div class="card-body">
                    <div class="table-responsive">
                        <table id="example" class="table table-striped table-bordered second" style="width:100%">
                            <thead>
                            <tr>
                                <th>Name</th>
                                <th>Status</th>
                                <th>IP-Address</th>

                                <th>OS</th>
                                <th>Time & Date</th>
                                <th>Total Devices</th>
                            </tr>```
stable kite
#

@glad patrol i asked package not code

#

@coral timber can you elaborate it

glad patrol
#

@stable kite i draw using bootstrap studio i dont know what package it use or not

stable kite
#

@glad patrol which are javascript file you have included in your html

coral timber
#

basically it's doing a validation to mysqldb model, when user input non unique value to that npwp and lokasi field, it's throwing the error

#

@glad patrol

stable kite
#

what do you want to do with error?

glad patrol
#
<script src="../assets/vendor/jquery/jquery-3.3.1.min.js"></script>
    <script src="../assets/vendor/bootstrap/js/bootstrap.bundle.js"></script>
    <script src="../assets/vendor/slimscroll/jquery.slimscroll.js"></script>
    <script src="../assets/vendor/multi-select/js/jquery.multi-select.js"></script>
    <script src="../assets/libs/js/main-js.js"></script>
    <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
    <script src="../assets/vendor/datatables/js/dataTables.bootstrap4.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
    <script src="../assets/vendor/datatables/js/buttons.bootstrap4.min.js"></script>
    <script src="../assets/vendor/datatables/js/data-table.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.colVis.min.js"></script>
    <script src="https://cdn.datatables.net/rowgroup/1.0.4/js/dataTables.rowGroup.min.js"></script>
    <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js"></script>
    <script src="https://cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js"></script>```
coral timber
#

@stable kite customizing it

#

if possible

stable kite
#
<script src="../assets/vendor/jquery/jquery-3.3.1.min.js"></script>
    <script src="../assets/vendor/bootstrap/js/bootstrap.bundle.js"></script>
    <script src="../assets/vendor/slimscroll/jquery.slimscroll.js"></script>
    <script src="../assets/vendor/multi-select/js/jquery.multi-select.js"></script>
    <script src="../assets/libs/js/main-js.js"></script>
    <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
    <script src="../assets/vendor/datatables/js/dataTables.bootstrap4.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
    <script src="../assets/vendor/datatables/js/buttons.bootstrap4.min.js"></script>
    <script src="../assets/vendor/datatables/js/data-table.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.colVis.min.js"></script>
    <script src="https://cdn.datatables.net/rowgroup/1.0.4/js/dataTables.rowGroup.min.js"></script>
    <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js"></script>
    <script src="https://cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js"></script>```

@glad patrol it is because of js file

glad patrol
#

which 1

#

can we identify?

coral timber
stable kite
#

@glad patrol data tables.min.js

glad patrol
#

this 1

#

<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>

stable kite
#

yes

glad patrol
#

comment out?

stable kite
#

@coral timber what do you need to do with this error on frontend

glad patrol
#

it remove

#

but also delete my cope pdf etc

stable kite
#

@glad patrol wdym

glad patrol
#

see this

#

and this

coral timber
#

@stable kite i need it translated to my language lol

glad patrol
#

it delte copy excel

#

search etc.

stable kite
#

because you have used the function of that js file

glad patrol
#

can we edit that js file

#

where it local it directory

stable kite
#

search for its documentation

#

there will be a way to not display that check it out

glad patrol
#

i will try

stable kite
#

@coral timber just change your string that your passing to messages.error()

sullen basalt
#

Hi when using the following in Django I get an error that my distinct on must match the initial order by

queryset = Test.objects.all().order_by('-id', 'field_A').distinct('field_A')```
#

But I don't want to distinct on id because this will not give me the result I want. Does anyone know how i can do this?

abstract kite
#

@sullen basalt distinct would do a select distinct on the field_A, how'd you order the result by id which doesn't exist in the result?

#

what you're trying to do is this, which will fail

select distinct field_A from Test order by id desc;
loud zephyr
#

I'm trying to create a test website. I want to be able to render all questions in a list view (not necessarily the django.generic.views one). The problem is that all questions aren't technically the same model. They all inherit from the same Question class, but they aren't all the same. For instance, FreeImageQuestion prompts an image, and MultipleChoiceQuestion presents radio buttons. I want to know how I can render all these loosely similar models in one list view, and I can check if the instance I'm working with is a specific child class of Question

gleaming herald
#

I have a API written in FASTAPI
The processing once request is received is around 2ms
But when there is stress testing done
The response time varies from 10ms - 20ms

#

Currently I'm using uvicorn as ASGI

#

I know network latency will play a role
But it's done from same network

#

Any tips for production deployment?

#

Ideally the response time that I require is under 5ms

quick cargo
#

Interesting that it's only 10-20ms tbh

#

Ive benched raw uvicorn having 30ms minimum going upto 2s

devout coral
#

Hello, anyone know if Django has a function with the same functionalities as reverse except it returns a full url?

versed python
#

@devout coral it doesn't. Yu will have to build it your self using the request object

#

i dont remember how exactly but I have the code somewhere

devout coral
#

No worries, I have a function that does it. I was just wondering.

stable kite
#

@versed python what does @devout coral mean?

devout coral
#

Actually itโ€™s a filter but Iโ€™ll just make a function for it

mystic wyvern
#

what is this ('board' object is not iterable)?

versed python
#

@versed python what does @devout coral mean?
@stable kite basically they want the current url. So if they are on the blog page, request.url will get them /blog but they want http://localhost:8000/blog.

stable kite
#

@versed python for that we have an inbuilt function that django provides

versed python
#

build_absolute_url?

stable kite
#

yes

versed python
#

it doesn't work

#

try it

stable kite
#

i think it works

#

ok

versed python
#

meh it might have been changed in 3.1, it didn't before tho

stable kite
#

just a sec trying it

#

@versed python it works

#

absolutely fine

#

@versed python in function just do py request.build_absolute_uri()

versed python
#

huh

#

that's weird

#

i remember having to write a function for it about 4 months ago in my own project

#

good to know though

wise crescent
#

"GET /static/bootstrap/js/bootstrap.bundle.min.js HTTP/1.1" 404 1833

#

[Django] does anybody know what's wrong with the error message above? I checked the STATICFILES_DIR in settings

stable kite
#

@wise crescent you don't have this file in your directory

wise crescent
#

I changed STATICFILES_DIR to STATICFILES_DIRS and solved it

#

thanks

mystic wyvern
#

'function' object has no attribute 'objects' guys plz help me

native tide
#

omg2rally, Can you show me the code?

mystic wyvern
#

the code about html or views

versed python
#

views

mystic wyvern
#

ok

versed python
#

what is article?

#

is it a model?

mystic wyvern
#

yep

native tide
#

Which line is causing the error?

#

It's django, right?

mystic wyvern
#

yeh django

versed python
#

can you show the whole view?

#

this is only a part of it

native tide
#

so which line is it?

mystic wyvern
native tide
#

I think maybe you mixed up the article function and the article model?

mystic wyvern
#

this line (art=article.objects.all())

native tide
#

maybe you should've named these differently

versed python
#

where is that line tho

livid warren
#

Hey can I post a doubt on JavaScript?

mystic wyvern
#

yep guys i mixed the function and model

#

its work now

#

thx

native tide
#

Yay!

#

๐Ÿ‘

quiet comet
#

in django, at ModelForm level can i override the save method so i can get the old data and the new one? i tried this but its the same new data

class ProductForm(ModelForm):
   class Meta:
       model = Product
       fields = '__all__'

   def save(self, force_insert=False, force_update=False, commit=True):
       print(self.data)
       print(self.cleaned_data)
       if self.changed_data:
           for field in self.changed_data:
               print(self.data[field])
               print(self.cleaned_data[field])```
#

same data, the changed data shows the fields changed but i cant get the old data :/

native tide
#

You can save the old data into an variable before you change it

quick cargo
#

@native tide we're not helping with that

quiet comet
#

i have this now

#
    def save(self, force_insert=False, force_update=False, commit=True):
        old_instance = Licences.objects.get(id=self.instance.id)
        if self.changed_data:
            for field in self.changed_data:
                print(field)
                print(self.data[field])
                print(old_instance)  # I need to acess this old_instance with the changed fields, but if i do this old_instance.field it doesnt work since that instance dont have a field 'field'
native tide
#

๐Ÿ˜€ ๐Ÿ‘

quiet comet
#

almost there , now i need to acess the old_instance with the changed fields

#

tried old_instance.field, " object has no attribute 'field'", tried old_instance[field], object is not subscriptable

humble stump
#

what's the full error

#

woops wc

quiet comet
#

used this getattr(old_instance, field), anyway it seems i fixed the prob 10min after asking the question and i was stuck in this for 2h before :/

humble stump
#

hey, any chance someone can kindly spend a moment to assist with my issue?

#

'm leveraging flasksqlalchemy to create my sqlite database, within a particular table i have a datetime column for... well.. dates and times.

#

the thing is i'm trying to pass multiple of these objects, instances of my table class (i.e rows) over to javascript

#

messing around with seems to be working but it can't serialise this datetime object

#

so i tried invoking the column call, within the table class, with strftime , as in, dbColumn(xxxx).strftime this returned a really weird error

native tide
#

What's the error?

warped mirage
#

I have a problem

#

Trying to drag and drop the db.sqlite3 file to db browser

#

but it wont load the file

#

what now ? o_O

#

it says no database file opened

umbral forge
#

So, more of an architecting question than a question on flask itself for designing routes. Let's say my API we're setting up needs to do the following:

  • Each site can have multiple reports
  • Each report can have multiple filters
  • A call to the report with the filters should return the dataset.

What's the least stupid way to set this up? Filters end up being sent as an xml object over post but we can do better than that probably.

warped mirage
#

Guys , can anyone help me out here , i would much appreciate it

#

I am trying to drag and drop the db.sqlite3 file from python to db browers for SQlite

#

but it wont let me

#

It gives me the error : No database file opened

quiet comet
#

if i want to add a new field to historical models in django-simple-history do i need to create a new model? the only example in the docs is history = HistoricalRecords(bases=[IPAddressHistoricalModel,]) but all i want is to add a new field string in the history

quiet comet
#

yeah i checked that but i cant import HistoricalUserBalance (in this case my own Historical Model)

thick cove
high jacinth
#

everyone , whats the best platform to use if i want to do uploads and downloads? i want to use a script to download an item to the platform and then upload from the platform to another service without using my actual machine. is that possible?

devout coral
#

is there a way to user getattr ins django to set the field's valur

quick cargo
quiet comet
#

i only used the getattr to get the data

night wharf
#

Hey i have an error while connecting Django to Postgresql can anyone help with that

#

This is the error that i get while making a server in PGadmin

quiet comet
#

are u are using port 53334 and the admin is asking about 5432?

devout coral
#

Anyone here have a good tutorial (written preferably) to make a pre loader

vernal vale
#

Any one please help
I have domain name .org and I want to change it to .com it can change free or I have to pay for .com domain

devout coral
#

Need to buy a new domain. Maybe where you bought it they have a return policy?

#

Anyone know where a function like this would go into a django project. Currently it is living in it's own .py file inside one of my app folders. It feels wrong and like I should have it somewhere else. (To note there are some other functions in this .py file as well)

def combine_attendance_documents(attendance_ids):
    """
    This function accepts a list of Attendance Ids and gets the PDFs associated with each of those and combines them
    into one PDF and returns it. Also if there is any counseling it will also add those PDFs

    :param attendance_ids: List of Attendance Ids
    :return: bytes object
    """
    buffer = io.BytesIO()

    merged_object = PdfFileMerger()

    for id in attendance_ids:
        attendance = Attendance.objects.get(id=id)

        merged_object.append(PdfFileReader(attendance.document.path))

        try:
            merged_object.append(PdfFileReader(attendance.counseling.document.path))
        except Counseling.DoesNotExist:
            pass

    merged_object.write(buffer)

    return buffer.getbuffer().tobytes()
coral linden
#

Hey! I've made a small chat app with flask and socketio (its really barebones atm) and im having problems deploying to google app engine.

Does anyone have an experience w/ this?

[ping me]

uncut spire
#

if i have a url with stuff in the path for a requests.get, do i need to manually urlencode it if it's "complex" or is that taken care of for me?

pine yew
#

@coral linden what's your specific issue?

coral linden
#

@pine yew i can successfully run the app locally but when deployed it doesnt work

#

the page goes up

pine yew
#

describe "doesn't work"

coral linden
#

but the socketio part is broken

#

lets get some error messages

#

well actually

pine yew
#

if I had to guess, you're getting wss errors

coral linden
#

you can check console there when sending chats

#

i had a 405 error due to me using http as my endpoint (because local doesnt use https), but i fixed that

pine yew
#
Firefox canโ€™t establish a connection to the server at wss://flask-chat-for-mckenna.wl.r.appspot.com/socket.io/?EIO=3&transport=websocket&sid=
#

you're trying to use GETs and POSTs?

#

for websockets?

coral linden
#

i just worked off a public socketio template

#

is it not supposed to use get-post?

pine yew
#

nope

#

you're supposed to establish a websocket connection

coral linden
#

i think it does

lavish prismBOT
#

Hey @coral linden!

It looks like you tried to attach file type(s) that we do not allow (.zip). 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.

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

coral linden
#

ah

lavish prismBOT
#

Hey @coral linden!

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

pine yew
#

your JS file is what I'm most interested in

coral linden
#

thats html btw

#

not xml

marble carbon
#

is there a way to user getattr ins django to set the field's valur
@devout coral setattr

pine yew
#

@coral linden this is your problem:

io.connect('https://

that should be wss://

#

for websocket secure

coral linden
#

oh really

#

let me try that

#

also one other small problem

#

when trying to deploy with flex env, and network session affinity

#

it doesnt update the service

#

but ill try it with that

#

hmmm

#

well testing locally gives me a 405

topaz widget
#

Does anyone know if it's possible in VSCode to have a 2 x 2 layout but with the rows sized independently from one another?

pine yew
#

you can't GET a websocket

coral linden
#
from flask import Flask, render_template
from flask_socketio import SocketIO

app = Flask(__name__)
app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#'
socketio = SocketIO(app)


@app.route('/')
def sessions():
    return render_template('session.html')

def messageReceived(methods=['GET', 'POST']):
    print('message was received!!!')

@socketio.on('my event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    print('received my event: ' + str(json))
    socketio.emit('my response', json, callback=messageReceived)

if __name__ == '__main__':
    socketio.run(app, debug=True)
#

so

#

get post methods arent viable

#
def messageReceived(methods=['GET', 'POST']):
    print('message was received!!!')
pine yew
#

correct

coral linden
#

so this should be changed

#

along with the socketio.on('my event')

pine yew
#

not quite

#

the code you have on the server side is valid

#

it just doesn't do what you think it does

coral linden
#

hmmm

#

so its only in the js inside that html file

pine yew
#

yeah

coral linden
#
var socket = io.connect('wss://' + document.domain + ':' + location.port);

      socket.on( 'connect', function() {
        socket.emit( 'my event', {
          data: 'User Connected'
        } )
        var form = $( 'form' ).on( 'submit', function( e ) {
          e.preventDefault()
          let user_name = $( 'input.username' ).val()
          let user_input = $( 'input.message' ).val()
          socket.emit( 'my event', {
            user_name : user_name,
            message : user_input
          } )
          $( 'input.message' ).val( '' ).focus()
        } )
      } )
      socket.on( 'my response', function( msg ) {
        console.log( msg )
        if( typeof msg.user_name !== 'undefined' ) {
          $( 'h3' ).remove()
          $( 'div.message_holder' ).append( '<div><b style="color: #000">'+msg.user_name+'</b> '+msg.message+ "\n" + '</div>' )
        }
      })
#

would there be a problem w/ the port?

#

it still has https://127.0.0.1:5000/socket.io/?EIO=3&transport=polling&t=NKaNtcQ which is get though right? @pine yew

#

(on local)

stone basin
#

I want to start a web project with some other collaborators. How do I make it so they can access the server (that I'll be hosting locally on my machine for the time being)?

#

When I do solo projects, I just start the server using node.js and open it on localhost, but then they can't access it

marble carbon
#

there's ngrok

versed python
#

@stone basin you'll have to use a code hosting service like github. Then if you want to make sure you have a good README to make sure your fellow developers are able to get it up and running. Other technologies include docker, docker-compose and yeah ngrok is okay too but it would just be for showing others, not actually allow others to edit code.

stone basin
#

I've used ngrok before to play Minecraft lol

marble carbon
#

you can use it to show them a preview of what you're working on

versed python
#

vscode live share is excellent too but I haven't used it personally

marble carbon
#

don't expect lightning fast speeds from it though

versed python
#

yeah it's very slow unless you pay up haha

stone basin
#

If we use GitHub, though, that means they won't be able to connect to my server

#

We'll just each have our own server running locally, but using the same code, right?

versed python
#

they can host a development environment on their own machine

marble carbon
#

yep

versed python
#

yeah pretty much

pine yew
#

@stone basin You can just port forward through your router

#

@coral linden I'm working on a quick implementation to show you

coral linden
#

thank you so much!

versed python
#

@pine yew the other developers would have to connect to your wifi for port forwarding to work

pine yew
#

@versed python You are 100% wrong.

versed python
#

oh

#

:(

pine yew
#

What port forwarding does is take network-external requests and forwards them to your internal IP

versed python
#

hmm where do I learn this stuff?

#

i dont even know where to start from

pine yew
#

uhhh, I'd recommend reading the training book for the CompTIA Network+ exam

#

it's a good start

versed python
#

I'll look into it

#

thanks

pine yew
#

@coral linden so you don't need to specify the host at all

#

the library connects to the current host by default

coral linden
#

in the js?

#

or py

pine yew
#

in the js

#

all you need is the call to io()

coral linden
#

o

#

wait let me try that locally

#

@pine yew wait so var socket = io()?

pine yew
#

yeah

#

it's literally one of the first things you see if you read their docs

coral linden
#

damn

#

ok one sec

#

works locally

#

let me try deploying

#

hmm

#

let me play with the app.yaml file

pine yew
#

make sure your wss ports are open

coral linden
#

65080?

pine yew
#

it's 443, not 433.

coral linden
#

im braindead

#

ok got that in, im going to add network session affinity

#

test it that works

#

if not

#

then ill try adding a flex environment on top of that (didnt work last time)

pine yew
#

take a step back and stop adding abstractions

#

understand the technologies you're using.

coral linden
#

What technologies do you think i should look into to accomplish this project? i would like to take time to actually learn how to make apps like this but i have to get this certain thing done in a reasonably fast amount of time. @pine yew

pine yew
#

well get it done, but you just throwing commands at google without even being able to read documentation for the tools you're using is :X

coral linden
#

ik it is

frozen python
versed python
#

I think the names of the files should be hint enough

frozen python
#

@versed python i had a class in the admin.py, but I changed it to models.py, what Is the difference of the two files to having a model in it?

versed python
#

technically you can have your models anywhere but models.py is called so because it's supposed to contain your models and admin.py is called so because it is supposed to contain admin modifications.

vestal hound
#

^

frozen python
#

@versed python do I need to add each field to the โ€œreturnโ€?

vestal hound
#

just like you could theoretically have all your code in one file.

#

i have a general http question. if my client server implementation uses custom headers that they know how to handle, is it considered bad practice to call them whatever you want, in the case of custom proprietary headers, is it better practice for them to start with X-? idk what these X headers i see are, ive assumed they where like html data attributes, if i want to have custom headers should i have them start with X-?
@tawdry magnet nope

#

it is recommended that they do not start with X-

#

(officially, AFAIK)

#

but honestly it doesn't matter

#

Creators of new parameters to be used in the context of application
protocols:

  1. SHOULD employ meaningful parameter names that they have reason to
    believe are currently unused.

  2. SHOULD NOT prefix their parameter names with "X-" or similar
    constructs.

versed python
#

@versed python do I need to add each field to the โ€œreturnโ€?
@frozen python wdym

frozen python
#

Do I need to add my field to whatโ€™s in the instance? I have name right now, then description.

versed python
#

i have no idea in what context you are talking

winter spindle
#

hwyy ?

#

heyy !

#

is it fine to learn django without learning flask

stable kite
#

@winter spindle yes but it would be to heavy to do so

winter spindle
#

soo like should i start with flask ?

#

like ik a little bit of flask

#

like render template

#

those decorators

#

jinja templating

#

ik basic flask tbh

#

@stable kite

stable kite
#

yes

versed python
#

@winter spindle Bruh just start with django if you want to. It might be heavier, but still a shorter path than first learning flask and then django

winter spindle
#

oh okay then !

#

@versed python

#

corey schafer's tutorials are good right ?

#

@frank ruin

versed python
#

Yeah thats where I learned from

#

But if you are good at reading documentation then go for django documentation tutorials. They are up to date whoch I cannot vouch for corey's tutorials

winter spindle
#

no i aint good at tht

nova nacelle
#

hello

#

i need some help!

gaunt marlin
#

ask your question @nova nacelle so people can help

nova nacelle
#

can you join code help.. so that i can explain?

gaunt marlin
#

i'm at work so i can't, better you just post what you having problem with

honest dock
#

Hello, django question! I'm sending email to like a 100 people, is there any way I can do this in the background? In C# we would do parallel processing. What is the best way to do it?

marble carbon
#

Celery

#

or Django-Q

grizzled sand
#

Hey everyone. Could you help me plz. Cant understand why get_context_data give me error object has no attribute objects

#
from django.views.generic import ListView, DetailView, TemplateView
from .models import Page


class PageListView(ListView):
    model = Page
    queryset = Page.published.all()
    context_object_name = 'pages'
    template_name = 'index.html'

class PageDetailView(DetailView):
    model = Page
    # context_object_name = 'services_list'
    # queryset = Page.published.all()
    # pk_url_kwarg = "post_id"
    slug_url_kwarg = 'slug'
    query_pk_and_slug = True
    template_name = 'page_detail.html'

    def get_context_data(self, **kwargs):
        context = super(PageDetailView, self).get_context_data(**kwargs)
        context['page_list'] = Page.objects.all()
        return context
green echo
#

How do I place an <a> element directly under an <img> element with a class="pic" attribute with pure javascript?

severe torrent
inner oriole
#

I'm getting a huge SMTPAuthenticationError when i am using gmail smtp on heroku with Django, what should i do?

loud zephyr
#

probably fix it

inner oriole
#

how tho

#

i tried everything, every smtp works except gmail

loud zephyr
#

Could you give any more details on the error?

inner oriole
#

sure just a sec

#

smtplib.SMTPAuthenticationError: (534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu\n5.7.14 DawewCJuPp97TJ0nA1XAkVQR-cxbFQ25RyDX0YI4HFuP1k2PljkRIFIpkDvVaCuFXG5er\n5.7.14 qzcJs1eEfnInqpHthepS39kuRVNCDlt9fcmpTmHfc7uru3JBKwJ_9tIuK30g2luS>\n5.7.14 Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 y10sm4746721wrq.73 - gsmtp')

#

idk if this helps

loud zephyr
#

This isn't really my area of expertise so no, it doesn't sorry

#

good luck though

inner oriole
#

thanks anyways

proven orchid
#

@inner oriole try allow authentication from unknown sources on google

#

that should do it ig

inner oriole
#

ok thanks

rich juniper
#

Hey guys, I'm a complete beginner, and I'm trying to print the text of a class of a html page. I can print the text of the entire page, and I can print everything within the class, but I can't print the text of the class?

#

schedulesoup = bs(schedule_page.text)
schedule=schedulesoup.find_all(text=True)
print(schedule)

weekbox=schedulesoup.find_all('ul')
print(weekbox)

week=weekbox.find_all(text=True)
print(week)

#

the first two work, but the last doesn't, and I don't understand

fallow silo
#

Can anyone reccomend a WYSIWYG html editor that allows accordioning of sections? I have a small project I need to tackle at work and don't want to learn HTML, CSS, and Javascript if I can avoid it.

#

Otherwise, any good reccomendations on an IDE for all three?

devout coral
#

@fallow silo have you taken a look at bootstrap? I think itโ€™s exactly what you need.

dreamy spruce
#

Is python good with web development if so can someone send me a course

native tide
#

I recommend watching Django Tutorial by Corey Schafer

versed python
#

@grizzled sand what line is giving that error?

native tide
#

Itโ€™s definitely good for beginners

dreamy spruce
#

Itโ€™s definitely good for beginners
@native tide thanks

versed python
#

also that looks like a pylint error. Is the view actually working?

sullen basalt
#

How do you write unit test for a function in Django? For example if I multiple 4 by 5 I expect 20. How do I do this?

versed python
#

@sullen basalt are you using pytest?

sullen basalt
#

No just the regular Django TestCases

versed python
#

then look into the basic tutorials django has. They contain a lot of test cases you can learn from.

devout coral
#

Anyone here have a good tutorial (preferably written) for making a pre loader for Django.

marble carbon
#

what's a pre loader

native tide
#

i think a loading screen

loud zephyr
#

I would love a good tutorial on that as well

marble carbon
#

It doesn't have anything to do with Django, just load the Javascript as u usually do in a template

devout coral
#

I know it has nothing to do with Django itself. The question was if anyone had a good tutorial for making a pre loader. If the person is using Django in the tutorial that is a plus.

marble carbon
#

hmm

devout coral
#

I know how I can make the pre loader in theory but is there a way to make it so that anytime any request is made the preloader is shown first? Because I was looking at a tutorial where the person was using Django but it seemed you would have to have the JS for every view or route. IDK maybe I am just confused on how the pre loader actually gets triggered or made.

grizzled sand
#

Hey everyone. Could you help me plz. Cant understand why get_context_data give me error object has no attribute objects
@grizzled sand solve it, my fault, tried get objects, but i was should use Page.published.all()

red pine
#

so django documentation recommends placing the template.html file inside polls/templates/polls/ folder. now what if i want to use the same template for another app ?

devout coral
#

Why would you need the same template in multiple apps?

red pine
#

i have a home app, a contact us app so i would like the layout of these pages to remain the same

devout coral
#

How do I get my manage.py back if I accidently deleted it...

#

@red pine You mean for like nav bar and stuff?

red pine
#

yes

#

header and footer

#

how do you organise you project ?

devout coral
#

In your home app you would make a main.html sort of like a "base file". Everything that all your templates would share (Header, footer, body tag etc.) Then you can use blocks to do extend on all your other templates.

red pine
#

yes. but what if you want to use this base file on other apps

devout coral
#

This explains it better than I coukd

#

The extend tag allows you to use it across apps

red pine
#

okay

devout coral
#
{% extends "main/base.html" %}

Like that

red pine
#

consider you are making a website for your school/college mostly static content. would you make a separate app for each page ( example Home, Admissions, About Us, Campus, Departments ) or you would put all of them in the same app ?

devout coral
#

Honestly it matters how you want to organize it. I normally seperate based on how I will be using those apps and their functionality. For your case I would only probably have one app since it is all mostly static.

#

However, if you were to lets say give functionality to the Departments where they can add events, or some other stuff then I would add it to a separate app. Just to separate it logically.

red pine
#

thanks. cleared a lot my my doubts.

devout coral
#

YW

swift sky
#

flask wtfoms

#

is there a way to do conditionals based on the validators? or somehow

#

I have a survey form, my objective is to show different questions based on previous answers

swift sky
#

or maybe it cxan be done in jinja, I see there are some documentation on it

#

but will it render html based on jinja conditionals

devout coral
#

If they are on the same page you will probably have to use js

limber laurel
#

Could someone share the ideas of their past web projects? I am looking for projects to work on that could make me learn.

versed python
#

!kindlings

lavish prismBOT
#

Kindling Projects

The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.

nova nacelle
#

hey @stable kite can you join code help now?

stable kite
#

how to find the strength of connection of user to website in django

#

hey @stable kite can you join code help now?
@nova nacelle why

nova nacelle
#

i had a doubt bruh

stable kite
#

ask here

nova nacelle
#

got to explain.... can you?

stable kite
#

what?

nova nacelle
#

My Problem, ofcourse

stable kite
#

sure i will try

nova nacelle
#

got to explain.... can you?
@nova nacelle i meant in the voice channel

stable kite
#

no

#

just ask here

nova nacelle
#

K. it's fine.

#

I'll ask when somebody joins in

#

thanks, anyways.

stable kite
#

is it related to web development?

nova nacelle
#

yes, it is.

stable kite
#

ok

hollow raft
#

I have downloaded a bootstrap theme, but it is currently a "complete" website, what exactly do i need to pull out to get it to work the same, but through Flask, so that I can begin to mold it to the site I want?

umbral forge
#

So in Flask I have a simple decorator auth_token_required which is declared in app.py, but I can't import it from foo/bar.py, what am I missing? Is there a better place to put the decorator/have it import in both files or...?

native tide
#

hElLo

devout coral
#

Hello

coral canopy
#

Question: I need to pick a web framework for, like, a medium-sized project (a blog with some extra bells and whistles, will involve some javascript on the frontend). I know of Flask and Django, and I know either can do the job. Are there any others I should definitely consider? Anybody have a favorite web framework I should definitely check out?

quick cargo
#

Knowing Flask and Django are two very solid frameworks

#

on the higher performance side i would highly recommend checking out Sanic

#

there is also other ASGI frameworks like FastAPI which is amazing for API stuff

#

but personally Sanic is my favourite :P

coral canopy
#

Thanks, I'll check it out ๐Ÿ™‚

#

oooh, their example looks very straightforward, I like that

pine yew
#

@umbral forge Do you have specific code to show?

#

What you're asking is more of a packaging question, where you would need some __init__.py files in the directories to do relative imports

umbral forge
#

In any case it turned out to be apache. That's another can of beans

upbeat vector
#

Hello, can someone help me with a issue on QnA maker on Azure?
I am working on the style of my QnA Bot
And i need to change a object property by clicking a button
The elements are on different files

#

(it's javascript)

pine yew
#

@upbeat vector Might have better luck in a JS-focused forum. I've always taken this channel to be focused towards the python frameworks more than the basic webdev toolkit

frozen python
gaunt marlin
#

@frozen python apps.py:
This file is created to help the user include any application configuration for the app. Using this, you can configure some of the attributes of the application.
models.py:
This file is created to declare model definitions for your database tables(basically a mapping of your app database structures). Django uses this definition to create the schema for the new table

native tide
#

Would this be an appropriate place to ask a question about Apache?

gaunt marlin
#

@native tide probably #networks is a better place to ask

native tide
#

okay thanks

frozen python
#

@gaunt marlin what if I donโ€™t add a app?

#

@gaunt marlin to apps.py, would that mess up anything?

gaunt marlin
#

@frozen python the apps.py file auto generate when you run python manage.py startapp, if you delete then it probably gonna return some error cause i never tried to deleted it before, but you are free to tinker with it ๐Ÿ™‚

frozen python
#

@gaunt marlin ok, but when would I add something to it?

versed python
#

when you need to

gaunt marlin
#

when you need to config your app like it's name or any attributes

frozen python
#

@gaunt marlin so, not often?

gaunt marlin
#

well when you need is basically not often

loud zephyr
#

Alright, I have this view and I want to be able to save form information. The problem is I am using a class-based view, and I can't just use if request.method == "POST": like I'm used to. How can I process form information in this class-based view?

class SectionDetailView(LoginRequiredMixin, DetailView):
    model = Section
    template_name = 'test/section.html'
    context_object_name = 'section'
versed python
#

@loud zephyr you'll have to override post

def post(self, *args, **kwargs):
    # whatever you want to do
    return super().post(*args, **kwargs)
loud zephyr
#

Thanks

#

I simply want to save responses to a database

versed python
#

yeah you can do whatever you want in there

rapid widget
#

Any nice flask course recommendation?

marble carbon
#

yeah sure

stable kite
#

how to find the strength of connection of user to website in django

gaunt marlin
#

probably required user to ping the server and test the connection

marsh canyon
#

Is it possible to scrape a website after the html is fully rendered?
example: https://lichess.org/study/topic/Tactics/popular
As you scroll downwards, the content increases.
I want all the content, i.e, after scrolling to the bottom of the page

dapper tusk
#

you would need selenium, but check the TOS of the site

versed python
#

You might need something like selenium to scroll for you

#

lichess is an open source website

#

they wouldn't mind

marsh canyon
#

oh alright

#

I will checkout selenium, thanks!

stable kite
#

probably required user to ping the server and test the connection
@gaunt marlin how to do that?

gaunt marlin
#

i haven't done it but it's just a suggestion @stable kite

stable kite
#

ok thanks for suggestions

gaunt marlin
#

maybe research about blizzard lookingglass website

#

i think it's the one that you thinking about

vapid acorn
#

Where should I store wether a user is logged in or not.
I have /todo and /todo/edit/ and I only want the user to see /edits/ contents if he is logged in.
I know, that there is built-in stuff in django to do this, but I want to do it myself.
Should I store a boolean in the session storage or cookies or like some kind of encrypted key so the user cant use set the bool to "True"?

#

Can you just change the session-storage or cookie-data?

gaunt marlin
#

@vapid acorn django has support for template with {% if request.user.is_authenticated %} you can use that to show or not show todo.edit. or you just to restrict it within view use if request.user.is_authenticated:

gaunt marlin
#

i use it to check for user login or not

river basin
#

hey guys so a quick question here: i tried to make a youtube_dl flask simple downloader and lauch it on heroku. it works fine on localhost, but on heroku it keeps erroring out. it says ERROR: Unable to download webpage: HTTP Error 429: Too Many Requests (caused by <HTTPError 429: 'Too Many Requests'>) in heroku logs, but it works just fine on local. Do i need to fake user-agent or smth?

dapper tusk
#

!ytdl

lavish prismBOT
#

Per PyDis' Rule 5, we are unable to assist with questions related to youtube-dl, commonly used by Discord bots to stream audio, as its use violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2019-07-22:

The following restrictions apply to your use of the Service. You are not allowed to:  

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;  

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโ€™s robots.txt file; (b) with YouTubeโ€™s prior written permission; or (c) as permitted by applicable law;  

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
river basin
#

fek sorry guys, mb ask somewhere else ๐Ÿ˜ didnt realise they are pirrots

median meteor
#

Hi i have some issue: I have a template in django and there is a form which I render it by just saying {{form.as_p}}
Now I have to add value to input tag on specific field

#

and currently.... I have no clue how to get to editting this

loud zephyr
#

@versed python I'm trying to find the documentation for the post() function you linked earlier, but I can't find it. Could you send the documentation link if you know where it is?

#

Is there any good documentation in general for using plain html forms with Django? (NOT THE FORMS MODEL IN DJANGO, PLAIN HTML)

quick cargo
#

Google html forms

loud zephyr
#

oh, I'll look into it

quick cargo
#

W3 schools has a section on it if I remember

loud zephyr
#

but I already know how to use forms in html

#

I need to know how to get Django to process it

quick cargo
#

Like you would any other system, via a Post requet

loud zephyr
#

I mean how does Django handle post requests in class based views

#

That's what I've been trying to figure out this whole time

#

New question: How can I do something similar to a DetailView where you can pass in a pk and have routes like /section/2 without actually using a class based view? Because from what I'm seeing, there's no documentation on how to accept and process forms in a class based view!

loud zephyr
#

thank you!

sullen basalt
#

How can you change the change page in Django Admin

loud zephyr
#

I'm kind of lost though

#

my form is not attatched to any class

#

its not forms.Form or forms.ModelForm

#

it's just html in a template

#

I guess my problem is that I need to know how to work with non-class based forms

versed python
#

you can have that too, but you wouldn't get django inbuilt form validation

loud zephyr
#

That's fine

versed python
#

you should swap that out for inbuilt forms though imo

loud zephyr
#

I don't think Django's form class can do what I want to do

versed python
#

otherwise you have to take care of sanitization and all other things that's not really worth the trouble

loud zephyr
#

the thing is, I think you have to have all field pre defined in django's forms

versed python
#

Django forms can do that easily though

loud zephyr
#

how?

versed python
#

the thing is, I think you have to have all field pre defined in django's forms
technically you can generate them programmatically but it's a bit difficult ime

loud zephyr
#

I have a Test model, can I create a ModelForm?

#

even with all this custom templating

versed python
#

yeah sure you can

#

I'll give you a brief example

#
class MyForm(forms.ModelForm):
     test_field = forms.CharField(
    widget= forms.TextInput(
         attrs={'class': 'all the classes you want', 
'styles': 'all the styles you want '}
      )
)
#

you can then use this form as you normally would

loud zephyr
#

huh

#

seems annoying but whatever

#

I'm still not seeing how to render my Test though

#

Can I do something like for question in model.questions: and then create TextInputs or whatever that way?

loud light
#

do you have your model fields in models.py ? if you written your database model, then in forms.py you can import " from .models import my_model "

loud zephyr
#

yeah of course I have them there

maiden gate
#

Please help me with sanic

I am trying to run this code:
url_for('/static', filename='/css/main.css')
But I have an error:
sanic.exceptions.URLBuildError: Endpoint with name /static was not found

swift sky
#

i have a design question
i have a web app
and I need to update content on a certain page
it needs to get updated every day
currently these updates are sent to all our users through email, but I need to somehow implement these updates in a page
any specific methods you guys recommend?
should I tackle this problem through somehow incorporating an email account that receives the updates and loads them into the page
should I make it so that a user has to manually load the content somewhere
how would I even do this without having to repush the code to the cloud every time

stable kite
#

@swift sky create a dynamic content website

native tide
#

I know I shared this link already BUT

#

this time it is updated

#

I need some honest feedback.

#

Also try it on mobile

versed python
#

it looks... too green

#

and kinda dull

loud zephyr
#

Also what's the deal with needing a login to view post details?

native tide
#

there is additional functionality on that page

#

wdym dull @versed python

#

oh I see

#

It needs images then.

versed python
#

and less lorem ipsum

native tide
#

I am the only user๐Ÿ˜…

versed python
#

not for long

native tide
#

๐Ÿคจ ๐Ÿค” ๐Ÿ˜…

vapid acorn
#

@native tide It looks like there is a very darkfilter on top of the website, and like I like the colors but there aint too much contrast in brightness

native tide
#

Do you have this problem on mobile where the nav already shows when it isn't even clicked on

versed python
#

nope

#

but I am on a tablet

native tide
#

ghmph weird

#

So it doesn't look like a nav bar @vapid acorn ?

vapid acorn
#

I would just make the background a bit brighter

native tide
#

what about on the mobile devices

vapid acorn
#

Did you use django?

native tide
#

Yes full DJango

vapid acorn
#

ok

#

And what type of database?

#

like is it postgres or sqlite or sth else

native tide
#

I just used default sqlite

vapid acorn
#

ok

native tide
#

which isn't really a good idea i heard

vapid acorn
#

@native tide I was talking about the general background, not the nav bar

#

I think the nav bar is looking good

native tide
#

oh oof thx

vapid acorn
#

Yeah it is better, but I would still give it some color, but a bright one

quick cargo
#

would also lessen but define that shadow a bit more

#

less blur radius

iron cliff
#

how do we import from another app?
from app.core.models import Tag
ModuleNotFoundError: No module named 'app.core'

plucky tapir
#

Would anyone be able to take a look at my files real quick? trying to use foreign key to link user and a form together

#

NOT NULL constraint failed: users_userinfo.author_id is the error

#

I see it a little common although not sure which is the right solution for me.

native tide
#

@iron cliff Can you show me your folder structure?

iron cliff
native tide
#

hi guys where to sell my apis

#

@iron cliff Try importing from core.models instead of app.core.models

iron cliff
#

@iron cliff Try importing from core.models instead of app.core.models
@native tide I tried but seems not working for tests

native tide
#

Okay. I'm not sure if this works but ..core.models might work

#

how to run django serverless

iron cliff
#

Okay. I'm not sure if this works but ..core.models might work
@native tide In this case I hover over objects and it says unresolved attribute and fails again. Thanks for reply, I will reset to last commit and try again
from ..core.models import Tag
queryset = Tag.objects.all()

honest dock
#

Hello, DRF question: what's the best approach I should follow to create a reset password API?

native tide
#

Okay, I'm sorry that I couldn't help you

#

drf?

#

django rest framework

#

aga

#

easy

#

would some one buy my user api

slender needle
#

Can you web develop with Python ?

dapper tusk
#

yes

slender needle
#

Ah, For that Iโ€™ll stick with HTML haha

bleak bobcat
#

Good luck doing backend with html

plucky tapir
honest dock
#

@slender needle you must have never coded to do a backend with html..

plucky tapir
#

Not getting any errors although I cant get the logged in user to automatically fill in the author in the models/registration form

marble carbon
#

Good luck doing backend with html
@bleak bobcat ๐Ÿ˜

native tide
#

quick stupid css question: is there a way to calculate in css? I need to set width to 90% + 40px.

bleak bobcat
#

There is a calc() function but I don't remember its limitations

native tide
#

perfect!

#

exactly what i needed ๐Ÿ™‚

#

thank you!

winter spindle
#

hwyy

#

heyy

#

i just wanted to have knowledge about those https and like port sockets like these terms

#

so can someone tell in which category do these topics come ?

#

networking ?

rich warren
#

what's the best microframework with DI ? sort of like spring (java) or symfony (php) ?

weary monolith
#

hey yall
For Flask extensions that register a blueprint in their init_app call, is there a way to add an authentication call to that blueprint after its registered or even before?

native tide
#

there is any front-end dev here ?

storm glacier
#

@native tide I've worked as Front-End dev earlier but now I've changed my career to Data Science.

#

Anyway what you want to ask?

native tide
#

@storm glacier i texted you

storm glacier
#

Ok

solid karma
#

does anyone have experience with

#

flask-discord module

frozen python
#

Creating a crud app, is allot more strait forward in Django, vs with React/Vue. To just add something, you have more places and steps of what you define to be able to make/add to something. Is there a simpler way with React vs Django? Django seems to be better than react with it

gaunt marlin
#

CRUD app on Django sure is fast to create but to customize it is hell because of it's auto generate design, React surely take longer but you can customize thing much easier. At the end of the day, pick what you prefer and needed

solid karma
#

Djago or Flask

#

ive seen a lot of Django no Flask

#

๐Ÿ˜”

frozen python
#

@gaunt marlin Iโ€™m trying to figure out which end I want to focus on. I like how python and Django are, but python is slow? What would be a faster? And in demand for the future?

jolly matrix
#

In css how can I show the lines of a grid?
I have made a square grid for an element, I want to see the grid itself in the webpage.

gaunt marlin
#

based on your definition of slow, sure it's slower than other language, but human won't even notice the speed of 0.00001 vs 0.001 second. And you can optimize it with cpyhton and database query(which the one that impact your website performance alot)

#

and website is different from script, language speed is basically nothing in web performance compare to routing, forward port, query,...

frozen python
#

@gaunt marlin thank you. Well with โ€œslowโ€ I donโ€™t truly notice anything, except, thatโ€™s what im always hearing about is โ€œslowโ€. I kinda can see the data size is bigger. Is python stable for the future? What is second, to also be familiar with?

gaunt marlin
#

i can't tell as i'm not following with the latest tech stuffs in languages, but right now it's popular as i can tell. If you into web developing the second language i recommend is javascript as it's help with developing frontend with django template and other web framworks that don't use python (for example node.js)

#

also help as machine learning use mostly python so you can use it native with django, because if different programming languages want to communicate each other they have to used api to transfer data(except for c cause you can just run with python after compiled)

frozen python
#

@gaunt marlin ok ๐Ÿ‘, I like JS, but at the same time, you seem to have to do more and use more syntax for the same thing that you can do, 10 different ways.... kinda. So thatโ€™s why JS dosnt click with me mainly. It took a while to get into JS because tutorials all use โ€œconsole longโ€ instead of truly using the code in a true example. But, Python/Django seems far more strait forward. I wish there was a front end way that was โ€œlighterโ€ that worked the same.

plucky tapir
#

should i be using class rather than functions and models? for django

versed python
#

I've never heard of function based models

#

@gaunt marlin ok ๐Ÿ‘, I like JS, but at the same time, you seem to have to do more and use more syntax for the same thing that you can do, 10 different ways.... kinda. So thatโ€™s why JS dosnt click with me mainly. It took a while to get into JS because tutorials all use โ€œconsole longโ€ instead of truly using the code in a true example. But, Python/Django seems far more strait forward. I wish there was a front end way that was โ€œlighterโ€ that worked the same.
@frozen python if you are not very good at js, React isn't the best way. Try to learn Vue, it has a really smooth learning curve.

gaunt marlin
#

models is a class in itself

#

django entire based on OOP

frozen python
#

@versed python react has actually helped me allot to get better at JS

#

@versed python Iโ€™ve used vue, I like it, but vue does add a bit of its own syntax that kinda messes me up

gaunt marlin
#

based on what views you using

#

there alot of views classes

versed python
#

@versed python Iโ€™ve used vue, I like it, but vue does add a bit of its own syntax that kinda messes me up
@frozen python huh to each their own ig

abstract tundra
#

Why is it that my logo gets cut off on the side, when i've zoomed in a lot?

#

this is my css:

.titleimg {
  max-width: 150%;
  max-height: 150%;
  width: auto;
  height: auto;
}
gaunt marlin
#

why not 100% instead of 150%? make the image inside the parent div responsive

wanton ridge
#

Are the webframeworks 'bottle' and 'flask' similar to each other? I saw on the internet that 'bottle' uses .route and 'flask' uses app.route. Are there any differences?

rich warren
#

I heard fastAPI is the most straight forward for api and comes with a handy documentation of your endpoints

pearl juniper
#

Hi guys - is anyone able to assist me with picking a websocket technology as per #help-candy

gaunt marlin
#

most web framework followed the MVC(models, views, controls) design, i work with flask and it followed the same principle, i don't know about bottle though but i think it would work the same way @wanton ridge

#

routing mean you assign a url to view(function)

wanton ridge
#

i see thanks@gaunt marlin

stray shard
#

hy

#

api

#

help needed

gaunt marlin
#

post your question instead of asking might help

stray shard
#

i want to install rakuten coupon api to my site @gaunt marlin

gaunt marlin
#

it's a package?

#

never heard of it

#

or you mean an actual API? then you have to use requests to call it

stray shard
#

how i can add an api to my website

#

simple steps

#

working first time with an api

zenith wind
#

@stray shard you can use DRF or Flask

stray shard
#

they work on wordpress

#

i have wordpress site

#

@zenith wind

gaunt marlin
#

wordpress is php based, probably can't help since this is a python discord server

stray shard
#

so where can you help me

#

atleast tell me how to add api's to wwordpress site

gaunt marlin
#

sorry can't help you would have better shot asking in wordpress or php server

#

wordpress not related anything to python

wise crescent
#

I'm creating Django account app. I forgot to put password in the create_superuser function. However, I migrated it. Then I added password in the function but I can't migrate it again. It says "no changes detected". I can't login to the admin page now, what should I do?

native tide
#

Hey !

#

We are creating a Django & AI startup with 2 other devs, can I post here to invite people ?

nova nacelle
#

I'm creating Django account app. I forgot to put password in the create_superuser function. However, I migrated it. Then I added password in the function but I can't migrate it again. It says "no changes detected". I can't login to the admin page now, what should I do?
@wise crescent you can delete the superuser and create a new one.

wise crescent
#

it's not working, I think I need to re-migrate it

nova nacelle
#

did you delete the superuser?

wise crescent
#

I deleted the whole database and migrate it again, it works now

#

did you delete the superuser?
@nova nacelle Yes, I tried

nova nacelle
devout coral
#

In Django, Do you not have to explicitly import your models into the views.py if they in the same app? I just noticed I deleted the imports and I am getting no errors....

devout coral
#

Can someone help me figure out how to remove the required attribute on a input element in a form using js. I have tried element.required = false; but no luck.

quick cargo
#

Why do you want to remove it exactly?

devout coral
#

So I can submit the form without needing to fill that field out

native tide
#

u using Django?

devout coral
#

Ye

quick cargo
#

Why not just have a default value?

native tide
#

set blank=True in model

#

in the field u want to be optional

devout coral
#

@native tide That has nothing to do with it.

#

I am using forms.Form not model form

#

I am talking about form validation not for saving to the database or anything

native tide
#

still u can set blank = True in from fields

devout coral
#

That field is not going to be saved to the database

#

I only need it for creating the PDF

#

@quick cargo Basically if the user selects a certain thing from the dropdown that field will show up otherwise it will be gone. THink of it like a dropdown with options then there is a other and you have to specify other.

#

Wait lol, I am dumb I got it. Forgot to edit the clean function on my form...

nova nacelle
#

Hello

#

needed some help in django.

stable kite
#

@nova nacelle what help?

nova nacelle
#

Is there a way to change the Username in Django?

stable kite
#

@nova nacelle like updating

#

the username

nova nacelle
#

kindof... But, do you think I haven't checked the internet before coming here?

stable kite
#

i think you should not changed username because it may get reflected with other user's username

nova nacelle
#

We can make it unique... or just check by .exists()

stable kite
#

I think user model manager has update method

native tide
#

usernames aren't unique by default?

nova nacelle
#

they are, it's about updating them

#

it does, but when i type in the id of another user in the url... i'm capable of changing his username too.

stable kite
#

@nova nacelle try py user.save(force_update=True)

nova nacelle
#

Hmm

devout coral
#

Any good way to have a field (including label and helptext) to be hidden by default. As is diplay none as oppossed to forms.HiddenInput()

true drift
#

so not sure if this channel is the best choice but I have a string of data scraped from a website that I want to turn into a dict, the problem is the keys don't have quotes so I'm getting an error with my normal method, any ideas?

lavish prismBOT
#

Hey @true drift!

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

true drift
#

and for reference this is data I'm taking from my schools covid stats page so not breaking any TOS's

stable kite
#

@true drift I think it is json

#

so you can use json module

true drift
#

I tried using json.loads but get an error

  File "main.py", line 24, in <module>
    print(json.loads(chart_data))
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 2 (char 3)```
#

I beleve that's due to naming issues? I tried it in an online json viewer and it works not sure why I can't get it to work here

stable kite
#

@true drift from where did you git this data like from an API service or something else

#

because your json structure is wrong

true drift
#

scraped from my colleges covid website, it's the data from the html chart

#

is there a better way I could convert it over?

stable kite
#

its objects of js

versed python
#

if it's basic html, no wonder it cannot be converted into json

stable kite
#

use js to convert it into json

#

than you use in python

versed python
#

you will have to parse the data manually and convert it into valid json first

true drift
#

ok

stable kite
#

@true drift store it in a variable in js & use JSON.stringfy()&you will get correct json

true drift
#

so no simple way to do it in purely python correct? The end goal for this is for a discord bot on my schools discord to send the stats in an embed

stable kite
#

no need do it manually

sacred gull
#

anyone got an idea why pycharm thinks this import is invalid?
I can run the server and it works just fine

#

huh. changed the root directory to 'first project' and now it doesn't show it as invalid anymore

#

ยฏ_(ใƒ„)_/ยฏ

tepid lark
#

Python paths ๐Ÿคฎ

keen night
#

I would like to create a very basic Web APP in which my coworkers would fill up a few variables, click on a button and I would receive the info (even by mail with a specific formatting is fine for me), do you guyz have any idea of a framework I could use ?

#

The simplier/faster to code the better, it doesnt need any shiny graphics, just a few inputs

crimson dagger
#

flask is awesome if you're just starting out

frozen python
#

I made a project and a app. Why is it that allot of tutorials donโ€™t really make a app at times? How much of a project do you have to have duplicated files for it to work????? Like models, views, urls???

acoustic oyster
#

duplicated files? you should never be duplicating code.

It sounds like you are doing django.

You should follow corey schafer's tutorials on youtube, they get you from 0 to an entire webapp.

frozen python
#

@acoustic oyster I have been, but when you make a โ€œappโ€ it seems like you duplicate files because itโ€™s not in the place you need classes/models/views?

#

@acoustic oyster a app dosnt have all the files you need. Itโ€™s different from the Django project directory

acoustic oyster
#

im not sure what your question is

#

yes, django forces a rigid file structure when you startapp

#

but a project has no set number of apps to work.

a project works with 0 apps. It just depends how many apps you need.

frozen python
#

@acoustic oyster โ€œProjectnameโ€ is the project, โ€œAppNameHereโ€ is the one app I have. The file itโ€™s all in is โ€œDDTESTโ€ I just did a quick name. Is this setup right?

vapid acorn
acoustic oyster
#

@acoustic oyster โ€œProjectnameโ€ is the project, โ€œAppNameHereโ€ is the one app I have. The file itโ€™s all in is โ€œDDTESTโ€ I just did a quick name. Is this setup right?
@frozen python it looks ok. Those pycache folders make me think you manually created each directory instead of using startapp though

#

but yes, it looks correct.

frozen python
#

@acoustic oyster ok, idk, I used โ€œstartappโ€. So, where should my views, models, urls be? Or to show data from my class/views I make?

#

@acoustic oyster should my pages be in the main Project? Or in the App part?

tepid lark
#

Django doesn't even require that file structure! But you should use it.

#

I like to name my project config, because it always ends up eating the cool app name

slender needle
#

@slender needle you must have never coded to do a backend with html..
@honest dock Backend ?

frozen python
#

@tepid lark should my app be within my project?

native tide
#

Did anyone launch serverless api

acoustic oyster
#

@tepid lark should my app be within my project?
you can put apps where you would like, but usually yes

#

sorry for lemon ping

tepid lark
#

If you're using plug and play apps a folder per app is great

#

Or have multiple ones

#

It's possible to do a single one off app without a project app basically

#

I have some SSO integration code I share between my work projects

#

That's its own app

dense bolt
#

One message removed from a suspended account.

frozen python
#

@tepid lark @acoustic oyster when I create a app, it puts it above the project folder by itself

pulsar ivy
#

Guys

#

I want to host for free my webapp on aws

#

Any suggestions

tepid lark
#

How are you running the create app command?

#

@pulsar ivy lambda with a wsgi adapter

#

or lightsail, it's not free but it's cheap

#

you could probably pay pennies with s3 and django/flask on lambda

#

plus cloudfront

#

but you gotta value your own time

velvet trellis
#

@pulsar ivy I would say give heroku a try itโ€™s quite easy and free

tepid lark
#

or that!

pulsar ivy
#

Hmm okay

#

Well i dont want to make it as brand site just to show off my skills like that

#

But thanks

frozen python
#

@tepid lark I open a new terminal and run the command. It dosnt create it if I enter the command in the same terminal as itโ€™s running. Nothing happens unless a new one is open

tepid lark
#

It will create a new app relative to where your pwd is, where you're running the command from

frozen python
#

Ok, so what happens when I just run it after a new terminal? Should I CD into anything?

#

@tepid lark

tepid lark
#

@frozen python It will run in the context of whatever your pwd is.

#

Yeah cd into your project root where manage.pyis!

frozen python
#

@tepid lark ok, thatโ€™s what do, but instead of โ€œcdโ€ the new terminal does that, I guess

tepid lark
#

pwd tells you the present working directory.

frozen python
#

@tepid lark whatโ€™s pwd? Some examples donโ€™t truly use everything to give you the right context

tepid lark
#

It's a command that tells you where you are in the shell.

#

Just type it in and hit enter.

left vigil
#

How to disable web browser caching for my flask app?

frozen python
#

@tepid lark so just open a new terminal and type pwd?

tepid lark
#

Yup.

#

Same process for FF dev tools.

left vigil
#

Same process for FF dev tools.
@tepid lark what?

#

what's ff dev tols

tepid lark
#

FireFox

frozen python
#

@tepid lark ok, that showed me the main file

#

@tepid lark I looked up Corey Shaffer... and itโ€™s a setup like his

tepid lark
glass badger
#

I'm about to launch an app using Digital Ocean, is build command where I do a pip install for all the libraries I used in my venv?

frozen python
#

@tepid lark my layout seems right then?, except for a couple files I duplicated..... I did that because it wasnโ€™t found within the App, should routes/views be within the app? Or project?

pine yew
#

@tepid lark 2014 is pretty old. is it still accurate?

tepid lark
#

Props to Django for not changing muhc.

#

@frozen python That looks fine. I usually like to have my projects like root -> project -> config -> manage.py

#

just because I'll have a Dockerfile and build scripts and so on under root

frozen python
#

@tepid lark ok, but I am running into a problem with views importing and urls

pine yew
#

@tepid lark not sure I'd give it props. it's losing marketshare pretty rapidly

quick cargo
#

Still one of the most popular backend frameworks around, at some point would be interesting to see their plan to move to async properly

pine yew
#

That would be such a huge breaking change I don't think they'll ever do it.

#

It would be a completely different framework

#

Also the WSGI standard isn't really meant for async programming which is why ASGI exists

frozen python
#

So, keep all routing inside the app?

quick cargo
#

Idk,it's was suggested at one point and they've been aggressively developing channels which is obviously their async skeleton system

#

Skeleton

#

@dapper tusk self bot alert

#

Never mind

#

Freaking seasonal bot