#web-development
2 messages ยท Page 100 of 1
yeah
yep
Cart functionality is surprising
There are no shopping functions on this site whatsoever
is that the timeline page u are trying to automate?
coz that's exactly what I saw on the homepage
yeah, that's what I'm trying to automate
is the wappalyzer analysis for that page?
yeah
okay
Just an educated guess, the code that's managing the posts should be under the "core" directory, right?
okay got it
Do I just control + F and search for the ID of the notification?
okay
type search in panel
press enter
will open a tab at the bottom, enter ID there and press Enter
screenshot
that's Ctrl + F
Nope
Well
going to "search in panel" in Ctrl + Shift + P
Is the equivalent of Ctrl + F
ah
drawer or network?
drawer
no matches found
try "display"
let me ensure I'm using the right ID
so it should be 1Course-col2-feedPane-newContent, right?
without quotes on either side
yeah
okay, still didn't find anything
Putting "display" in the search bar yielded many results
try class name maybe
not all of them, put them one by one, try all sorts of combinations
how do I tell it to prettyprint?
idk
include 7 lines present right above this code and 7 lines present right below this code
above in terms of structure, or literally 7 lines above this line
latter
how do I do that?
hmm wait
I told u to do a global search ๐, were u only searching within that core engine js file
do it for all
for xds-newContent it found one result within the css file
engine.min.css
but that's design, not actual code
ik
unresponsive...
ah well
I was searching for "unread"
i gotta sleep now, try opening a help channel by following the instructions in #โ๏ฝhow-to-get-help, good luck
โ๏ธ
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
the most you can do is check for click event listeners on those notifications
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
this is because you don't have this on it's described location
just show where it is located
online someone ans this
Delete the line /*# sourceMappingURL=bootstrap.css.map */ from bootstrap.css
this is because you don't have bootstrap.css.map
i delete but the result is same
ok so i need to donwload .css.map
and pasted in css directory?
yes but it throw error in browseer console
yes it will
heyy
this is a warning not error
@stable kite then why it didnt show my result
@winter spindle django official tutorial & documentation
its empty table
no i write the script
which script?
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>```
are you having any data in your data.json?
yes
are you sure?
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?
@stable kite i paste it how to execute it?
just press enter
where is your #table in your html
omg
work
gg
gg
but 1 problem
it say no data avaible but down it dsiplay ๐
@glad patrol have your problem solved?
because it is hard coded
@glad patrol just use inspecter to find which html does this
ok 1 mint
just see your ip address &status column
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
are you using an package for tables?
hello, im new to django and python
i need help how to customize this error message
<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 i draw using bootstrap studio i dont know what package it use or not
@glad patrol which are javascript file you have included in your html
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
what do you want to do with error?
<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>```
<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
@stable kite
@glad patrol data tables.min.js
this 1
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
yes
comment out?
@coral timber what do you need to do with this error on frontend
@glad patrol wdym
@stable kite i need it translated to my language lol
because you have used the function of that js file
i will try
@coral timber just change your string that your passing to messages.error()
solved it with this documentation https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#considerations-regarding-model-s-error-messages
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?
@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;
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
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
Interesting that it's only 10-20ms tbh
Ive benched raw uvicorn having 30ms minimum going upto 2s
Hello, anyone know if Django has a function with the same functionalities as reverse except it returns a full url?
@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
No worries, I have a function that does it. I was just wondering.
@versed python what does @devout coral mean?
Actually itโs a filter but Iโll just make a function for it
what is this ('board' object is not iterable)?
@versed python what does @devout coral mean?
@stable kite basically they want the current url. So if they are on the blog page,request.urlwill get them/blogbut they wanthttp://localhost:8000/blog.
@versed python for that we have an inbuilt function that django provides
build_absolute_url?
yes
meh it might have been changed in 3.1, it didn't before tho
just a sec trying it
@versed python it works
absolutely fine
@versed python in function just do py request.build_absolute_uri()
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
"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
@wise crescent you don't have this file in your directory
'function' object has no attribute 'objects' guys plz help me
omg2rally, Can you show me the code?
the code about html or views
views
yep
yeh django
so which line is it?
I think maybe you mixed up the article function and the article model?
this line (art=article.objects.all())
maybe you should've named these differently
where is that line tho
Hey can I post a doubt on JavaScript?
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 :/
You can save the old data into an variable before you change it
@native tide we're not helping with that
i have this now
old_instance = Product.objects.get(id=self.instance.id)
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'
๐ ๐
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
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 :/
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
What's the error?
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
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
sitecan have multiplereports - Each
reportcan have multiplefilters - 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.
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
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
yeah i checked that but i cant import HistoricalUserBalance (in this case my own Historical Model)
How can I find out why I'm getting this ๐
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?
is there a way to user getattr ins django to set the field's valur
Server progress ๐คฃ
i only used the getattr to get the data
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
are u are using port 53334 and the admin is asking about 5432?
Anyone here have a good tutorial (written preferably) to make a pre loader
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
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()
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]
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?
@coral linden what's your specific issue?
@pine yew i can successfully run the app locally but when deployed it doesnt work
the page goes up
describe "doesn't work"
if I had to guess, you're getting wss errors
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
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?
i think it does
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.
ah
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:
Hey @coral linden!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
your JS file is what I'm most interested in
is there a way to user getattr ins django to set the field's valur
@devout coral setattr
@coral linden this is your problem:
io.connect('https://
that should be wss://
for websocket secure
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
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?
you can't GET a websocket
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!!!')
correct
not quite
the code you have on the server side is valid
it just doesn't do what you think it does
yeah
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)
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
there's ngrok
@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.
I've used ngrok before to play Minecraft lol
you can use it to show them a preview of what you're working on
vscode live share is excellent too but I haven't used it personally
don't expect lightning fast speeds from it though
yeah it's very slow unless you pay up haha
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?
they can host a development environment on their own machine
yep
yeah pretty much
@stone basin You can just port forward through your router
@coral linden I'm working on a quick implementation to show you
thank you so much!
@pine yew the other developers would have to connect to your wifi for port forwarding to work
@versed python You are 100% wrong.
What port forwarding does is take network-external requests and forwards them to your internal IP
uhhh, I'd recommend reading the training book for the CompTIA Network+ exam
it's a good start
@coral linden so you don't need to specify the host at all
the library connects to the current host by default
damn
ok one sec
works locally
let me try deploying
hmm
let me play with the app.yaml file
make sure your wss ports are open
it's 443, not 433.
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)
take a step back and stop adding abstractions
understand the technologies you're using.
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
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
ik it is
I think the names of the files should be hint enough
^
@versed python do I need to add each field to the โreturnโ?
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 withX-?
@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:
SHOULD employ meaningful parameter names that they have reason to
believe are currently unused.SHOULD NOT prefix their parameter names with "X-" or similar
constructs.
@versed python do I need to add each field to the โreturnโ?
@frozen python wdym
Do I need to add my field to whatโs in the instance? I have name right now, then description.
i have no idea in what context you are talking
@winter spindle yes but it would be to heavy to do so
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
yes
@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
oh okay then !
@versed python
corey schafer's tutorials are good right ?
@frank ruin
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
no i aint good at tht
ask your question @nova nacelle so people can help
can you join code help.. so that i can explain?
i'm at work so i can't, better you just post what you having problem with
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?
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
How do I place an <a> element directly under an <img> element with a class="pic" attribute with pure javascript?
I'm getting a huge SMTPAuthenticationError when i am using gmail smtp on heroku with Django, what should i do?
probably fix it
Could you give any more details on the error?
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
thanks anyways
@inner oriole try allow authentication from unknown sources on google
that should do it ig
ok thanks
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
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?
@fallow silo have you taken a look at bootstrap? I think itโs exactly what you need.
Is python good with web development if so can someone send me a course
I recommend watching Django Tutorial by Corey Schafer
@grizzled sand what line is giving that error?
Itโs definitely good for beginners
Itโs definitely good for beginners
@native tide thanks
also that looks like a pylint error. Is the view actually working?
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?
@sullen basalt are you using pytest?
No just the regular Django TestCases
then look into the basic tutorials django has. They contain a lot of test cases you can learn from.
Anyone here have a good tutorial (preferably written) for making a pre loader for Django.
what's a pre loader
i think a loading screen
I would love a good tutorial on that as well
It doesn't have anything to do with Django, just load the Javascript as u usually do in a template
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.
hmm
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.
Hey everyone. Could you help me plz. Cant understand why
get_context_datagive me error objecthas no attribute objects
@grizzled sand solve it, my fault, tried get objects, but i was should usePage.published.all()
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 ?
Why would you need the same template in multiple apps?
i have a home app, a contact us app so i would like the layout of these pages to remain the same
How do I get my manage.py back if I accidently deleted it...
@red pine You mean for like nav bar and stuff?
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.
yes. but what if you want to use this base file on other apps
This explains it better than I coukd
The extend tag allows you to use it across apps
okay
{% extends "main/base.html" %}
Like that
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 ?
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.
thanks. cleared a lot my my doubts.
YW
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
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
If they are on the same page you will probably have to use js
Could someone share the ideas of their past web projects? I am looking for projects to work on that could make me learn.
!kindlings
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.
hey @stable kite can you join code help now?
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
i had a doubt bruh
ask here
got to explain.... can you?
what?
My Problem, ofcourse
sure i will try
got to explain.... can you?
@nova nacelle i meant in the voice channel
is it related to web development?
yes, it is.
ok
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?
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...?
hElLo
Hello
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?
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
Thanks, I'll check it out ๐
oooh, their example looks very straightforward, I like that
@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
In any case it turned out to be apache. That's another can of beans
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)
@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 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
Would this be an appropriate place to ask a question about Apache?
okay thanks
@gaunt marlin what if I donโt add a app?
@gaunt marlin to apps.py, would that mess up anything?
@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 ๐
@gaunt marlin ok, but when would I add something to it?
when you need to
when you need to config your app like it's name or any attributes
@gaunt marlin so, not often?
well when you need is basically not often
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'
@loud zephyr you'll have to override post
def post(self, *args, **kwargs):
# whatever you want to do
return super().post(*args, **kwargs)
yeah you can do whatever you want in there
Any nice flask course recommendation?
yeah sure
https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
The Flask Mega-Tutorial Part I: Hello, World!
how to find the strength of connection of user to website in django
probably required user to ping the server and test the connection
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
Free online chess server. Play chess in a clean interface. No registration, no ads, no plugin required. Play chess with the computer, friends or random opponents.
you would need selenium, but check the TOS of the site
You might need something like selenium to scroll for you
lichess is an open source website
they wouldn't mind
probably required user to ping the server and test the connection
@gaunt marlin how to do that?
i haven't done it but it's just a suggestion @stable kite
ok thanks for suggestions
maybe research about blizzard lookingglass website
i think it's the one that you thinking about
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?
@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:
i use it to check for user login or not
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?
!ytdl
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)
fek sorry guys, mb ask somewhere else ๐ didnt realise they are pirrots
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
@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)
Google html forms
Or alternatively, is there a way to render dynamic forms such as this? This is currently a DetailView of the Test model
oh, I'll look into it
W3 schools has a section on it if I remember
but I already know how to use forms in html
I need to know how to get Django to process it
Like you would any other system, via a Post requet
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!
thank you!
How can you change the change page in Django Admin
huh i see someone already sent it to you
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
you can have that too, but you wouldn't get django inbuilt form validation
That's fine
you should swap that out for inbuilt forms though imo
I don't think Django's form class can do what I want to do
otherwise you have to take care of sanitization and all other things that's not really worth the trouble
I'm trying to use forms to render my tests like so
the thing is, I think you have to have all field pre defined in django's forms
Django forms can do that easily though
how?
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
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
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?
yeah of course I have them there
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
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
@swift sky create a dynamic content website
I know I shared this link already BUT
this time it is updated
I need some honest feedback.
Also try it on mobile
Also what's the deal with needing a login to view post details?
there is additional functionality on that page
wdym dull @versed python
oh I see
It needs images then.
and less lorem ipsum
I am the only user๐
not for long
๐คจ ๐ค ๐
@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
Do you have this problem on mobile where the nav already shows when it isn't even clicked on
I would just make the background a bit brighter
what about on the mobile devices
Did you use django?
Yes full DJango
ok
which isn't really a good idea i heard
@native tide I was talking about the general background, not the nav bar
I think the nav bar is looking good
Yeah it is better, but I would still give it some color, but a bright one
how do we import from another app?
from app.core.models import Tag
ModuleNotFoundError: No module named 'app.core'
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.
@iron cliff Can you show me your folder structure?
@iron cliff Can you show me your folder structure?
@native tide
hi guys where to sell my apis
@iron cliff Try importing from core.models instead of app.core.models
@iron cliff Try importing from
core.modelsinstead ofapp.core.models
@native tide I tried but seems not working for tests
Okay. I'm not sure if this works but ..core.models might work
how to run django serverless
Okay. I'm not sure if this works but
..core.modelsmight work
@native tide In this case I hover overobjectsand 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()
Hello, DRF question: what's the best approach I should follow to create a reset password API?
Okay, I'm sorry that I couldn't help you
drf?
django rest framework
aga
@honest dock This link might help you: https://stackoverflow.com/questions/3077229/restful-password-reset
easy
would some one buy my user api
Can you web develop with Python ?
yes
Ah, For that Iโll stick with HTML haha
Good luck doing backend with html
models - https://dpaste.org/oT4U
views -
https://dpaste.org/V70Y
@slender needle you must have never coded to do a backend with html..
Not getting any errors although I cant get the logged in user to automatically fill in the author in the models/registration form
Good luck doing backend with html
@bleak bobcat ๐
quick stupid css question: is there a way to calculate in css? I need to set width to 90% + 40px.
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 ?
what's the best microframework with DI ? sort of like spring (java) or symfony (php) ?
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?
there is any front-end dev here ?
@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?
@storm glacier i texted you
Ok
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
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
@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?
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.
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,...
@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?
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)
@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.
should i be using class rather than functions and models? for django
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.
@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
@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
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;
}
why not 100% instead of 150%? make the image inside the parent div responsive
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?
I heard fastAPI is the most straight forward for api and comes with a handy documentation of your endpoints
Hi guys - is anyone able to assist me with picking a websocket technology as per #help-candy
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)
i see thanks@gaunt marlin
post your question instead of asking might help
i want to install rakuten coupon api to my site @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 you can use DRF or Flask
wordpress is php based, probably can't help since this is a python discord server
sorry can't help you would have better shot asking in wordpress or php server
wordpress not related anything to python
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?
Hey !
We are creating a Django & AI startup with 2 other devs, can I post here to invite people ?
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.
it's not working, I think I need to re-migrate it
did you delete the superuser?
I deleted the whole database and migrate it again, it works now
did you delete the superuser?
@nova nacelle Yes, I tried
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....
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.
Why do you want to remove it exactly?
So I can submit the form without needing to fill that field out
u using Django?
Ye
Why not just have a default value?
@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
still u can set blank = True in from fields
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 what help?
Is there a way to change the Username in Django?
@nova nacelle like updating
the username
kindof... But, do you think I haven't checked the internet before coming here?
i think you should not changed username because it may get reflected with other user's username
We can make it unique... or just check by .exists()
I think user model manager has update method
usernames aren't unique by default?
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.
@nova nacelle try py user.save(force_update=True)
@nova nacelle https://www.youtube.com/watch?v=TXJNuOwmb-4
#Djangosuperuser #djangoshellscript
Creating superuser rename,change the password and delete the superuser using python shell script
Hmm
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()
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?
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:
and for reference this is data I'm taking from my schools covid stats page so not breaking any TOS's
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
@true drift from where did you git this data like from an API service or something else
because your json structure is wrong
scraped from my colleges covid website, it's the data from the html chart
is there a better way I could convert it over?
its objects of js
if it's basic html, no wonder it cannot be converted into json
you will have to parse the data manually and convert it into valid json first
ok
@true drift store it in a variable in js & use JSON.stringfy()&you will get correct json
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
no need do it manually
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
ยฏ_(ใ)_/ยฏ
Python paths ๐คฎ
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
flask is awesome if you're just starting out
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???
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.
@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
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.
@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?
I have a web-dev related question in #help-candy
@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 usingstartappthough
but yes, it looks correct.
@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?
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 you must have never coded to do a backend with html..
@honest dock Backend ?
@tepid lark should my app be within my project?
Did anyone launch serverless api
@tepid lark should my app be within my project?
you can put apps where you would like, but usually yes
sorry for lemon ping
@frozen python https://github.com/fisher60/Friendo_Site_Django/tree/develop here is an example project structure
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
One message removed from a suspended account.
@tepid lark @acoustic oyster when I create a app, it puts it above the project folder by itself
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
@pulsar ivy I would say give heroku a try itโs quite easy and free
or that!
Hmm okay
Well i dont want to make it as brand site just to show off my skills like that
But thanks
@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
It will create a new app relative to where your pwd is, where you're running the command from
Ok, so what happens when I just run it after a new terminal? Should I CD into anything?
@tepid lark
@frozen python It will run in the context of whatever your pwd is.
Yeah cd into your project root where manage.pyis!
@tepid lark ok, thatโs what do, but instead of โcdโ the new terminal does that, I guess
pwd tells you the present working directory.
@tepid lark whatโs pwd? Some examples donโt truly use everything to give you the right context
It's a command that tells you where you are in the shell.
Just type it in and hit enter.
How to disable web browser caching for my flask app?
@tepid lark so just open a new terminal and type pwd?
Yup.
@left vigil https://stackoverflow.com/a/7000899
Same process for FF dev tools.
FireFox
@tepid lark ok, that showed me the main file
@tepid lark I looked up Corey Shaffer... and itโs a setup like his
This one is good too:
https://www.youtube.com/watch?v=ajEDo1semzs
By Mark Lavin
Websites built with Django are built on "projects" which are composed of oneor more "apps". But what is a project really? This talk will dissect a Django project to understand which pieces are convention and which are required. It explain what if anything separat...
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?
@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?
@tepid lark 2014 is pretty old. is it still accurate?
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
@tepid lark ok, but I am running into a problem with views importing and urls
@tepid lark not sure I'd give it props. it's losing marketshare pretty rapidly
Still one of the most popular backend frameworks around, at some point would be interesting to see their plan to move to async properly
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
So, keep all routing inside the app?