#web-development
2 messages · Page 55 of 1
@zealous siren I have a back-end architecture question for web. Is this the correct place to ask it?
both installed after uninstalling what i had ...got the same thing again and now getting the same error
j sure?
@zealous siren
Ok. I asked in the help channel but no one responded, so I'll paste it here
Or if you want, it's in #help-pear
Ok it was moved to dormant
I'll just paste it here.
I'm working with time-series data and need to use Python libraries in the process (talib). The client-side is VueJS and makes requests to a GraphQL server (Hasura) which is connected to timescaleDB.
So VueJS <---> Hasura <--> timescaleDB.
I will be creating Python microservices to run analytics on the timeseries data in timescaleDB (which is SQL btw).
When the client makes simple requests for raw data (eg. to view a chart) the request goes from Vue to Hasura to timescaleDB.
However when the user makes a complex request, it needs to go to the Python service that performs analysis on the timeseries data and returns the response.
I want to know where the Python microservices fit. Do I have to connect them to Hasura so that the complex query is sent to Hasura by the user and then is sent off to the Python service which then connects to timescaleDB independently, or does the Python service also connect to Hasura via GraphQL?
So I’m not familiar with those apps so my questions will be general
Most of time queries will go to Hasara for processing but occasionally they are too complex and need to be dealt with by python before Hasara?
Most of time queries will go to Hasara for processing but occasionally they are too complex and need to be dealt with by python before Hasara?
Yes
so you need a router service
and likely processing service
so Router determines straight to Hasara or not, and processing service that will run the code then pass it to Hasara service
in theory, you should have query service because multiple microservices, same database is frowned upon but baby steps
So VueJS -> Router --maybe--> Processing (which will they reach into DB) -> Hasara
Router/Processing could be same as well
Depends on how deep you want to go
in the past when I've had to do complex queries over time series data, I create a separate "summary" table and run the expensive queries offline so the user experience is snappy
that's a very common practice
in the past when I've had to do complex queries over time series data, I create a separate "summary" table and run the expensive queries offline so the user experience is snappy
Yes, preprocessing and saving results for reuse?
@zealous siren ok thanks. I was wondering how I could make Python sit between Hasura and Timescale
yes, since it's a time series data (which are almost always immutable data), it's safe to store the results of the expensive queries as the "truth" instead of running expensive queries at user-experience time
Essentially I'm hoping to have a single GraphQL endpoint for the user.
yes, since it's a time series data (which are almost always immutable data), it's safe to store the results of the expensive queries as the "truth" instead of running expensive queries at user-experience time
Ok yes I thought so. I guess my next question is how do you determine when to draw the line on storing stuff?
So, for example stuff I'd use a lot like an indicator, say normalized average true range, would be saved as another column along with the time-series data
Or you're saying to separate the summary data from the raw stuff
from their website, it doesn't look like you can sit custom code between them and the database, but they have a discord community you can ask https://hasura.io/learn/#hasura-discord
yes, separate the summary data from the raw data
sure, caching is great but Rome wasn't built in a day
Ok thanks guys this was very helpful. Will come back when I have Python specific questions. Sorry if this was a bit off-topic
when deciding to separate, I usually ask "does this data power a page in my app for the user/customer?" and "does the query consistently take longer and a couple seconds and tax the database or data API service?" - if both are yes, I make an event summary for the query
this isn't cacheing, it's running long queries offline and saving the results
Sure but if queries are not commonly repeated, caching results may not make sense
and sometimes it's cheaper to throw some more hardware then overhead of storing and retrieving cache results 😄
if the answer to "does this data power a page in my app for the user/customer?" is yes, the queries are commonly repeated
again, not a cache lol, a separate table of data
i'm here
(continuing from #help-grapes ) ok let's talk about context locals
alright
when flask runs, there are different levels of a "global" variable that persist
there's the normal stuff, things like variables inside functions, the python language handles that
but when we start our flask app, we also assign a config to that app, which are things like the database URL, the debug flag, etc. that live on the context of the "app"
these variables persist inside the context of the app, and are available when flask runs your code
It's not letting me use emoji reactions wtf. Lol
from flask import current_app
but when we start our flask app, we also assign a config to that app, which are things like the database URL, the debug flag, etc. that live on the context of the "app"
@cold anchor it's related topython app.config['SQLALCHEMY_DATABASE_URI']?
exactly that
these variables are shared across all server processes, threads and requests being handled
as such it's imperative that you don't modify them after the app starts
Sure but if queries are not commonly repeated, caching results may not make sense
He's saying to make a separate data table for summary data in addition to the raw data.
it have to be static as long as the app runs?
I don't think there's anything stopping you from changing them while the app runs, but it's a bad idea, because it's shared across multiple threads
(it can't be shared across multiple processes, because they can't share variables in the same way)
when deciding to separate, I usually ask "does this data power a page in my app for the user/customer?" and "does the query consistently take longer and a couple seconds and tax the database or data API service?" - if both are yes, I make an event summary for the query
This is very helpful. Thank you!
hmm
the next step down from the app context locals (link: https://flask.palletsprojects.com/en/1.1.x/appcontext/) is a request context local (https://flask.palletsprojects.com/en/1.1.x/reqcontext/)
but like, my concern is: how does the program manage multiple connections
like this
made on paint with absolute painting skills
beautiful
so when a request comes in, the thread handling it creates a new request and session context to handle the connecting user
flask does it for you
oh
that's also a big discussion, we can cover that later
so it's half way to make an online game
it already plugs people on "different ports"
idk if it's the port or just the ip that changes, the ip makes more sense
sort of, again that's a little out of scope of this for now
that's closer to the operating system than we need to care about
but that already explained a lot
i mean, in my head, when a user was logged in, and another one logs in it could cause trouble if i did not handle that on code
anyway back to this idea of a "request context": when flask gets a new request, it creates a new context for you to handle global variables for that request flask.g
that's where flask.g and flask.session come to the rescue
they're entirely created and destroyed within the lifetime of a single request
so if user A and user B send a request at the same time, they still won't overlap because they're two different requests
does that answer your question?
yes, it's separated
alright, that solves the question
@cold anchor thank you man, saved the day
i was going nuts
idk the words to search for it online
those links I posted about the request and app contexts are good reads
i'll read them now
hi everyone.. I'm not sure what the appropriate channel would be to ask a question about tweepy... any suggestions?
I want to host a server on my machine. All I need to do is to forward one port and write
server_socket.bind(('0.0.0.0', forwarded_port))```
?
or should the IP be the external router ip
@signal yoke If you only want to access it locally (i.e. from other devices connected to the same network) then 0.0.0.0 is fine, otherwise it has to be your external IP.
Someone suggests me a book for django
With selenium do I need to actually link to where I have the Firefox driver? It seems to be working without actually linking it like so
firefox_browser = webdriver.Firefox()
but every tutorial i've read and watched so far they link to the drivers executable.
hey if it's working, wassa problem
my hunch is that it looks for it in "standard" places if you don't tell it exactly where to look, and yours is indeed in a standard place
yeah, whenever i tried to do it as
firefox_browser = webdriver.Firefox('./geckodriver.exe')
it wouldn't work at all
said it couldn't find the file
when it was in the same folder
well ... this is like one of the biggest annoyances ... . doesn't mean what you think it means
it means "the current working directory of the python process", but not neccesarily "the directory this file is in"
anyone have experience with web crawlers?
What's the best way to go about changing the django admin page? I'd like to extend my base.html including the header and everything
https://kanin.naila.bot/2020/04/23/I4Qmnt this is what I've currently got, by recreating the admin/base.html, removing the header, and extending my base.html, though I'm sure this isn't the way to go about it
Who use Vue or react with Django/flask
Is use js framework with Django/flask good choice
??
I use Vue with Django
Oh
I am learning Vue
And i am kinda lost
@pseudo tapir what does vue do when your using Django
vue is frontend
Ok
What is it like to use a JavaScript framework with Python backend? Like, do you still render templates at all?
Like an infinite loop of 302?
Look for somewhere in youre control flow where you're calling a redirect where the condition always true.
@mixin grid-row-span($start, $end) {
grid-row-start: $start;
grid-row-end: $end;
}
@mixin grid-col-span($start, $end) {
grid-column-start: $start;
grid-column-end: $end;
}
it sassy
haha I just realized I didnt need to write that mixin, they already have a property that combines those two.
@queen bough are you sure? doesn't 0.0.0.0 means "all traffic"?
I assume on the client site it has to be the external ip
flash(error_handler[error])
sleep(3)
return redirect('redir')```
It's not showing the msg box :/
I would like to redirect user to another site and let him know that
flask
I think that 0.0.0.0 means broadcasting on the local network. So whatever network its on, it means its serving to every localhost on the network? I think thats how it works anyway.
hi I'm new hear i now somethings about Django and rest but i need big picture of what i need to learn to launch full flagged site with it like online store with it
someone help me out with this.....i have installed vs redist 14.25 and build tools from visual studio installer...it still gives the same error
these are the package installed in my system
Anyone using vue flask ?
guys how can i write on this button?
{{ form.submit(class="mtr-btn signin") }}
it appears empty
Flask or django ?
i'm using flask but into the form i already writed onto
like that submit = SubmitField('Accedi')
but if i put the style through the "class" keyword
the word disappears
it shows the word just without any style
it should not amtter u are just adding the class do you have anything related to the text in css to that style ?
mm i have to check because the template is pre-made free usage
but if i remove the class
the word appears good onto the button
i'm uploading a screenshot of the button but it's a bit slow
You dont have to remove class
is there anything
inside that class
that is related
to text
it can cause trouble
keep the background
color etc
but remove everything that is related to text inside that class
what is saying bad gateway? gunicorn? your app server (flask? django?) your reverse proxy (nginx? apache?) or something else?
nginx
what ever
I've tried 3 tutorials already and haven't got anything working
ima go back to the first one..
what's your nginx config look like?
and is your application server binding to 0.0.0.0? (I've found not binding to that specifically can cause problems)
@queen bough are you sure? doesn't 0.0.0.0 means "all traffic"?
@signal yoke0.0.0.0binds to all "IPs" of the PC - so localhost, and its IP:
https://superuser.com/questions/949428/whats-the-difference-between-127-0-0-1-and-0-0-0-0
https://en.wikipedia.org/wiki/0.0.0.0
https://www.howtogeek.com/225487/what-is-the-difference-between-127.0.0.1-and-0.0.0.0/
HTH.
hm, so then you'd only want to bind to 0.0.0.0 when you want your app available at any IPv4 address pointing to that server, and you'd want to bind to 127.0.0.1 when you want the app available only to another process on the local machine (like nginx)
WHY
WHY
fuckin
I hate configuration files, why can't they be simple and they have to be in 10 different placesAAAAA
I tried to freakin reinstall apache2 and still doesn't work
it worked the first time
already in use
lsof -i:80
what's the nginx config got for forwarding rules?
it had my server's ip
It still doesn't work, I did systemctl stop nginx
can i restart this server so it doesn't run these
I'm not super familiar with these commands, but as long as it doesn't have a "spin this process back up when the server restarts" mechanism that should work
Any good courses/resources out there on Web Development with a particular focus on Python?
input:checked + .content #grid {
display: grid;
}
You really dont need JS anymore...
I've got this script that's meant to recolour all of the elements with the ID, but i can't even get it it to fire
document.onload = function () {
console.log("document loaded!")
var coll = document.getElementsByTagName('div');
var arr = [];
for(var i = 0; i < coll.length; i++) arr.push(coll[i]);
arr.forEach((elem) => {
let rgb_elem = document.getElementById(`rgb ${elem.id}`)
let rgb = hexToRgb(elem.style.backgroundColor)
rgb_elem.textContent = `RGB: (<span style='color: rgb(${rgb.r}, 0, 0)'>${rgb.r}</span>,<span style='color: rgb(0, ${rgb.b}, 0)'>${rgb.b}</span>,<span style='color: rgb(0, 0, ${rgb.g})'>${rgb.g}</span>,`
})
}
I am importing it from a .js file via <link>. Do i need it to be a local script?
apologies if its bad js i don't use it that much
anyone know how to get the public ip of the user in Django???
I'm not the best at JS either but
document.getElementById(`rgb ${elem.id}`)
Is that valid? Aren't you allowed to have spaces in ids? I find that rgb-whatever would be more common. That might not be the problem....
document.addEventListener('DOMContentLoaded', function () {
console.log("document loaded!")
var coll = document.getElementsByTagName('div');
var arr = [];
for (var i = 0; i < coll.length; i++) arr.push(coll[i]);
arr.forEach((elem) => {
let rgb_elem = document.getElementById(`rgb ${elem.id}`)
let rgb = hexToRgb(elem.style.backgroundColor)
rgb_elem.textContent = `RGB: (<span style='color: rgb(${rgb.r}, 0, 0)'>${rgb.r}</span>,<span style='color: rgb(0, ${rgb.b}, 0)'>${rgb.b}</span>,<span style='color: rgb(0, 0, ${rgb.g})'>${rgb.g}</span>,`
})
})
even with this, its still not firing
TLS thats not the issue, but the event isn't firing
the rest is fine
I'm assuming you have it deferred at the end of the html? If so, not sure. Im pretty new to JS.
Ill try
nothing
it doesn't seem to be loading the script at all wtf
even when i slap the contents in a <script> tag still nothing
You could try putting it directly into script tags to see if it works. Maybe its pathing isssue
Ah well damn
The other day I forgot to have a closing </script> on my <script> and it caused it to not load but its not that then.
hang on
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DragDev Studios - Branding</title>
<meta content="" name="description">
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="site.webmanifest" rel="manifest">
<link href="icon.png" rel="apple-touch-icon">
<link href="js/main.js" rel="script">
<!-- Place favicon.ico in the root directory -->
<link href="css/normalize.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<meta content="#fafafa" name="theme-color">
<style>
html, body {
margin: 0;
padding: 0;
}
div {
min-width: 100%;
margin: 0;
padding:15px;
min-height: 4em;
}
</style>
</head>
<body>
<h1>Colours:</h1>
<div style="background-color: #a34142" id="MemberRed">
<h2>"Member Red"</h2>
<ul>
<li>Hex: <code>#a34142</code></li>
<li id="rgb MemberRed">RGB: <i>Not calculated</i></li>
</ul>
</div>
<script defer>...</script>
</body>
</html>
in <script>
function hexToRgb(hex) {
let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
document.addEventListener('DOMContentLoaded', function () {
console.log("document loaded!")
var coll = document.getElementsByTagName('div');
var arr = [];
for(var i = 0; i < coll.length; i++) arr.push(coll[i]);
arr.forEach((elem) => {
let rgb_elem = document.getElementById(`rgb ${elem.id}`)
let rgb = hexToRgb(elem.style.backgroundColor)
console.log(rgb)
if (rgb === null) {
alert(`unable to calculate RGB of hex ${rgb}`)
}
rgb_elem.textContent = `RGB: (<span style='color: rgb(${rgb.r}, 0, 0)'>${rgb.r}</span>,<span style='color: rgb(0, ${rgb.b}, 0)'>${rgb.b}</span>,<span style='color: rgb(0, 0, ${rgb.g})'>${rgb.g}</span>,`
})
})
console.log("hi")
thats all ive got right now
8080 or 81 is common.
alternate http ports that is
what is in that main.js?
i dont see why that would matter tho
I would try umm removing document.addEventListener('DOMContentLoaded', function () { and then just having it at the very end so that it naturally loads the script after the content is loaded.
I think you can take that defer out, I think the defer keyword is for when you have the JS at the top of the file and still want it deferred. Other than that, I have no idea.
so I need to make a search engine functionality on my django website which will filter the topics by the searched keyword
not sure how to go about it
actually nvm
I'll figure it out
ok, check the error logs
got it working thx for help
Hello guys,
I need to do data scrapping on this page : https://www.iqair.com/france/normandy/le-havre/le-havre-ville-haute
and I need the AQI value
I coded with selenium, a program that register an account. But often i have problem, because sometimes there is recapcha
How can i prevent recapcha or other relative problems
bluemore it looks like you can just run the same request that the javascript is running to get the data at https://staging-website-api.airvisual.net/v1/stations/4t5XoboksgD4eB4Dq/measurements?units.temperature=fahrenheit&units.distance=mile&AQI=US&language=en
I was wondering what orm tool do the majority of users here use
SQLAlchemy is my favorite
Is it easier to work with?
easier than writing you own db driver, yes
lmao well that too
I was wondering which might be easier to implement since I am trying to write a webserver using fastapi
I know they had some docs around it
try googling for "fastapi sqlalchemy" and see if any libraries come up or "fastapi sqlalchemy cookiecutter" to see if there are any working templates you can use
I am actually looking at the cookiecutter now
that's whole point of recapcha to prevent what you are doing
@zealous siren Yes i know that, but im searching for some way that prevent recapcha
i tried to modify payload of post request, i modified useragent, ip (using proxy), chrome window size, but it doesnt work
thanks @cold anchor
@toxic marten you see the flaw in that thinking? Hey, we implemented the thing to stop you so how do I bypass my TOS violating behavior
So to end this conversation
!rule5
Can anyone assist me in using https://stoplight.io/ with Django? I honestly have no idea where to start but their API docs are beautiful
I've never done anything like this, and I've read their docs and don't think i understand exactly what I'm to do lol
Is that for building or testing?
I believe they have both https://ipgrabber.pls-dont.click/2020/04/23/ePuWHX
I mainly want their docs, but I haven't looked into the design thing much
That looks like it’s API prototyped
So it’s for design and building
Like early design
I know they use it over here https://docs.thecatapi.com/ and it's beautiful
This looks like it’s not for building the APIs
Like writing the actual code for APIs
I see, so does this question not belong here? I'm just not sure how to get those docs myself
Yes
Python?
Yep, Django
No
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Yes
What?
Is this brand new site?
Not really
Don’t build API Django unless it’s something tiny or you already have
FastAPI for building APIs
I'd like the site to all be in Django, one project, thanks for the suggestion though 😄
I want to create a project called POLLSTER that will have one app called POLLS. I am following these steps but I am getting confused.
- Create a new folder called POLLSTER – this will be the name of the project.
- Inside of POLLSTER folder, run
python -m venv env, which will create a virtual environment folder called ENV within the POLLSTER folder. - Inside of \POLLSTER\ENV\ folder run
activateto activate the virtual environment. - Inside of POLLSTER folder run
python -m pip install Django(if the environment is activated, does it matter where this command is run?).
I’ve followed the above instructions from the official Django website and I have my project folder (POLLSTER) created but now the instructions are telling me to run django-admin startproject <projectname>. My issue is that this will create a project (POLLSTER) folder, which I have already done.
Correct me if I am wrong but the idea is to install Django inside of a virtual environment, and to have the virtual environment folder to be within my project folder. So if I’ve already created the project folder, why is the django-admin startproject <projectname> making another project folder?
OK, so here's what's going on
- There's your outermost folder, which contains your main project directory and your venv directory
- The project directory will have in it one or more Django sites created by Django itself
Your outermost folder could be called pollster-project
ok got it
The folder for django-admin startproject could just be pollster
and the app within Django could just be called polls
the virtual environment you can just call env
OK
That's about what I expected
PHEW
So now when you open pollster-project in VS Code, for instance, it'll autodetect env as the environment for it
it's just confusing that it makes a folder called POLLSTER within the POLLSTER folder lol
This is one of the reasons I don't really recommend Django to people as their first web framework; it can get really unwiedly if they don't know that it's like this
It's designed like this because it assumes you may want to have more than one app sharing the same site configuration
yea i hear that. although i have lots of coding experience so i really just have to get over these first few bumps. the code itself won't be an issue
and honestly the toolset it provides you with is really powerful
yeah i hear it's 'batteries included' compared to flask
they give you everything you need for a serious enterprise application
here it is in vscode, if anyone cares 😛
if the name of my app is polls , then visiting the 'polls/' url would mean that the pattern being sent to urls.py is simply ''
.... right?
(an empty string)
can anyone point me a good ressource for the whole slug topic in django? I just can't get my head around it and the examples or often so specific that i can't transfer it to my personal project ....
dm or @me pls. Im heading to sleep
huh, never heard of "slugs"
How can i use aiohttp for Image Scraping
Anyone with google app engine experience able to help me with a problem? I'm trying to restrict access to certain URLs so they can only come from within my application (cloud tasks to be precise). With python 2's app.yaml I could do this with login: admin on those URLs but I cant find an equivalent with python 3. Any advice?
hi guys how can i try to make telegram bot and import telegram but dont know how to get image from user?
any one can help me ?
Can anyone help why I can't use a list iteration in this js script in my html using flask?
<script>
$(function() {
var cfg = {
pieceTheme: 'https://koblenski.github.io/javascript/chessboardjs-0.3.0/img/chesspieces/wikipedia/{piece}.png',
position: 'start'
};
var board = ChessBoard('myBoard', cfg);
var game = new Chess();
// 1. Load a PGN into the game
var pgn = {{details[0]|tojson}};
game.load_pgn(pgn);
$('#pgn5').html(pgn);
// 2. Get the full move history
var history = game.history();
game.reset();
var i = 0;
// 3. If Next button clicked, move forward one
$('#nextBtn5').on('click', function() {
game.move(history[i]);
board.position(game.fen());
i += 1;
if (i > history.length) {
i = history.length;
}
});
});
</script>
```
var pgn = {{details[0]|tojson}}; is where it seems to break...
Django
I know that there is the prepopulated_field in the django admin panel.
This seems like a great way of populating slugs.
How can i generate a slug when the object is created from a form ?
Can i somehow do stuff like : Form Input 1 = slugField ?
Does somebody know how to get data from HTML forms using Python?
Pin @ me if you know how pls
3 ways:
- Use the forms that Django already provides. (i dont know all of them, but there is a user form for example that asks you for a username and a password)
- Edit the forms that Django already provides. (add an E-Mail field)
- Write your own forms.
https://docs.djangoproject.com/en/3.0/topics/forms/
Has anybody ever parsed RSS 2.0 XML, because I am a bit stuck on content:encode...
flask vs django
bit more context ?
depends on what you want to achieve / build
Another user here stated that with flask you learn a lot more of the whole web things because you do most of the stuff by yourself.
Django provides so much functionality that you just go with so much without apreciating / learning the things in the background.
If youre getting really frisky with your stuff flask gives you more freedom, even though i can't define the limits of django when it comes to flexibility.
For some really simple projects and display applications django might be an overkill
I could imagine a chat app not being the easiest starter project ... with that message handling and stuff.
Maybe theres a good tutorial online though? Then just stick to that :D
hi guys I'm trying to connect my raspberry pi gpio with google assistant through ifttt, I have a trouble in establishing a connection between my Raspberry pi and ifttt, I'm running a flask server in raspberry pi
can anyone help me
What's up guys so i wanna ask you... I see when people work on some website projects or anything else they have a specifc file for things so data bases in this file view in the view file so im working on a website project rn and I wanna know how they do that and how they link the files together ?
what do you mean? can you clarify that a bit more?
for which framework? a framework like django has module separation built in
but you need to do it yourself for something like flask for fastapi
oh
the repo I just shared use django
but what about flask because im working with flask rn?
yeah you have to do it yourself, here's a project I did a while back that I open sourced when I stopped trying to get customers for it https://github.com/Rdbaker/weasl-api
The API for weasl.in. Contribute to Rdbaker/weasl-api development by creating an account on GitHub.
cool
but I didn't understand how i can do it myself?
because if I made different flask files everyone will be a single website
make a new file and put some functions or classes in there, then import it at from myapp.utils import get_user_agent_header for example from maybe a view file
ohhhh
So i make sepreate files then I import them in one file if that what you mean
yeah, into the relevant file
oh actually I don't know how they do it
what specifically is confusing you?
I don't know how to link them together or from myapp.utils import get_user_agent_header idk how to use this if you can explain it or give a link for someone else expalin it,I will appreiate that
this might help https://realpython.com/flask-blueprint/
oh I will check it out actually this thing was confusing me for a along time thanks
I'm trying to integrate some python scripts into my web app, but I think I'm misunderstanding certain fundamentals.
I'm getting the following error:
ERROR 2020-04-24 15:12:24,358 signal 8 140184647079744 Signal handler <bound method DjangoFixup.on_import_modules of <celery.fixups.django.DjangoFixup object at 0x7f7f47457fd0>> raised: DatabaseError("Execution failed on sql 'SELECT * FROM Profiles': no such table: Profiles")
It's referring to this line of code:
if profiles is None:
profiles = pd.read_sql_query("SELECT * FROM Profiles", conn_mp)
The table and database doesn't exist yet, but why am I getting the error if I'm not trying to run the script yet?
All I did was save and build it, and it's throwing the error.
I have allowed my templates to grow so complex and numerous with poorly named files that don't match that I want to cry (not reall) thinking about what a mess it is.
The problem is that when I made the templates, I was using them in one place.
But over time the need for the same content to be plugged all over resulted in them being everywhere with the original names that in the end dont reflect entirely what is on the template. So many templates with similar names.
Its bad.
I will never make this mistake again though
Hi all
What are the most common options for mySQL databases to deploy a flask application with?
Is an sqlite database good enough for a production application?
Thank you.
An sqlite database isnt really a database at all. It's more... the sort of thing you use in a development environment for simplicity. No one can actually connect to it, which people need to do to use a database.
I use a postgres database and am not that familiar withg mySQL but its fairly common.
by mySQL I meant any database that isn't noSQL, sorry
so I guess postgres could count
right, well I use postgres and there is a free tier postgres addon to heroku if you want to pracitce with a free production level set up
oh ok thanks
Hmm, anyone here well versed in Django?
I have a problem with setting up Postgres with it, but the Django server is p. dead atm, & Stackoverflow doesn't have any problems/answers to my specific issue, apparently
nope sorry :'D
sliding in with my own question though:
Django:
Whats the default way of populating fields that are not supposed to be filled in by the user ?
Example: Field A is half the value of Field B + some other calculations.
Anyone here is using Seleniumwire?
Hey all, I have a project that has a Flask backend w/ Selenium and a React front end. Everything seems to work fine locally. I was wondering if anyone knows of a good tutorial on how to deploy this project to a production server (Ubuntu)?
How can i login and register on instagram using requests? Someone can explain me just basics
Hello all, here is an article on how to deploy Flask + PostgreSQL in a couple of seconds: https://docs.qovery.com/guides/tutorial/deploy-flask-with-postgresql/
Let me know what do you think about it 🙏
guys, this tells me 'list object has no attribute items'
ffriends = Friends.query.filter_by(account_owner=current_user.id).all()
friends = []
for item in ffriends.items:
friend = Account.query.filter_by(id=item.friends_id).first()
friends.append(friend)
posts = []
for friend in friends:
post_ = Post.query.filter_by(owner=friend.id)
posts.append(post_)
return render_template('index-2.html')```
am i doing something wrong?
@rich plaza Thanks for the article it definitely makes deployment look simple. I'm just a little confused with what qovery is doing in the background. In addition to deployment is it also hosting the project?
@rich plaza Thanks for the article it definitely makes deployment look simple. I'm just a little confused with what qovery is doing in the background. In addition to deployment is it also hosting the project?
@cold socket yes exactly, hosting, managing the database, generate SSL certificate and more than that. You can see it as the heroku of 2020 :)
@rich plaza Wow that is very convenient. So it hosts everything on AWS?
And does it have ssh access for each application instance?
@rich plaza Wow that is very convenient. So it hosts everything on AWS?
@cold socket yes exactly. And you have the choice of the region
@cold socket yes exactly. And you have the choice of the region
@rich plaza why would you need SSH access ?
@rich plaza My Flask app also uses selenium, so to install drivers or even monitor usage
Ah yes. Of course you can. You deploy container on Qovery. So you can install selenium and all you need
hey i serving gridfs stream from a flask server and i am not able to do seek on videos on the html side
it turns out this is possible on other browsers and not on chrome due to some headers and wrong status
so how can i handle this on flask?
Does my python version have to be the same on production as development for Flask application?
@tired root as to how ? the same server is also used for other purposes
@cold socket Does not need to be, but prepare for quirks
How drastic of a difference is 3.7.4 vs 3.8
It's highly suggested it does
@sick hedge Let's first separate server software and server hardware
I am talking about software
It would be generally no issue to run a second server software on the same hardware on a different port alongside nginx/apache/whatever
My idea would be something like a WebRTC streaming server for this case
ahh ok
@cold socket You would need to look at the changelog
@sick hedge I am quite sure that implementing that yourself with Flask would be a very challenging task
so I'd look at something like antmedia
A second option is to use a dedicated second hardware server to handle this task
via a subdomain like video.example.com
just point the A and AAAA record to that second IP
Good afternoon! I'm trying to understand what are VDom but I haven't found docs about the concept on the web, just docs of libraries. Do you know where I can find a library-agnostic explanation of it? Here is what I've understood so far, is it at least correct or am I wrong?
The Javascript objects are basically the virtual DOM
VDOM is an object that represents how it should be displayed, but it is not an actual thing
well, not in a pure browser view of things
The browser only knows one DOM
@feral turtle
Hi
I have to use an API
To use this API I need to use curl
How can I get the result into a var ?
Like, getting the output, putting it in a var named request, then parsing it using json this way req.json()
Where are you using this api from?
just a python app?
If so, then you can use requests which will be much easier than curl
This is how the request looks like:
curl -X GET "https://mawaqit.net/api/2.0/mosque/search?word=lyon" -H "accept: application/json" -H "Api-Access-Token: XXXXXXXX
Yes, thats it in the command line
not in python
is this question relate to python?
How can I "translate" it to Python ?
@native tide https://curl.trillworks.com/
Utility for converting curl commands to code
you'd use the requests library
@tired root You're a hero
import requests
r = requests.get("https://mawaqit.net/api/2.0/mosque/search?word=lyon", headers={"Api-Access-Token": XXXXXXXX})
r.json()
@rigid laurel You forgot the params
or well, you included them in the url
but its better to send them as parameters
oh yeah - I didn't even notice they were a thing, just copy pasted - you're right
Hero
@native tide I am not. I just know how to use google
It is generally easier for you if you just type things into google first. THere's nothing wrong with asking here, but often you'll get an answer faster by just checking google. Of course if you're struggling to understand something, have a problem you can't solve, or want a more detailed discussion, this server is the right place to ask
Yeah.
One more problem.
This is how the JSON results looks like
I want to get the "05:06"
I use this
time = json["times"][0]
This should work, yeah ?
Because I get this error: TypeError: list indices must be integers or slices, not str
req = requests.get("https://mawaqit.net/api/2.0/mosque/search?word=lyon", headers={"Api-Access-Token": "6"})
json = req.json()
mosquee = json[0]["uuid"]
req = requests.get("https://mawaqit.net/api/2.0/mosque/search?word=" + mosquee, headers={"Api-Access-Token": ""})
json = req.json()
fajr = json["times"][0]
dohr = json["times"][1]
asr = json["times"][2]
maghreb = json["times"][3]
icha = json["times"][4]
ville = json["localisation"]
And it doesn't work? Try print(json) above fajr ...
mosquee = json[0]["uuid"]
Where does uuid come from? Why not id?
It does come from the first request
Ah mosque/search?word= looks wrong - perhaps you meant id/uuid?
req = requests.get("https://mawaqit.net/api/2.0/mosque/search?word=" + mosquee, headers={"Api-Access-Token": ""})
Please use the params dict for that
This is just yucky
No worries.
@native tide https://hastebin.com/luwosogani.py
It's me again, I still don't understand at all what are vnodes and how they're used to render a page
Guys how I can create a box that just show up when someone click a specific lets say submit button so the user can't accsess the whole page (just the box that shows up)
I just found a link that explain that
You can just add a function
js
Which creates a box
when the submit button is clicked
Use json.loads
who in here has created a sneaker bot?
there's something funny about that phrase
https://www.youtube.com/watch?v=NNZscmNE9QI there's a video tutorial for sneaker bots here
Ever wondered how to make a sneaker bot? You should watch this video!
Check us out at:
https://pythondiscord.com
https://discord.gg/python
why am I afraid to click
Pros: you get to hear the dulcet tones of Lemon. Cons: You have to click
it's not from the is-odd guy, it's a different person. Not sure if thats good or bad
if you don't have a certificate that supports https then the https connection will not be secure
that looks pretty explicit, you need to upgrade the version of tls that you support
how do i do that
depends on a lot of things, like the hosting service you're using primarily
can you be more explicit?
google cloud platform? google domains? google app engine..?
google cloud platform
just keep giving details please
ok
i use google cloud platform vm for my hosting
and name.com for my domain
and i installed my certificate using certbot
ubuntu/apache
directly on a server? are you using a load balancer?
yes, over ssh. no load balancer.
ok, so you're pointing your domain name directly to your server that's running apache on port 443?
when did you install the certificate?
about half an hour ago
and you followed these instructions https://certbot.eff.org/lets-encrypt/ubuntuxenial-apache ? (or whatever version of ubuntu you're running)
it looks like it might be an issue with the apache config https://tecadmin.net/enable-tls-in-modssl-and-apache/
How to disable SSLv2, SSLv3, TLS 1.0, TLS 1.1 in mod_ssl and Apache. Also this tutorial will help you to enable TLS 1.3, TLS 1.2 in Apache server.
try following those instructions and see if it works
how do i edit the apache configuration? @cold anchor
do you know where the config is that you're running? this is pretty basic stuff, how did you get it running in the first place?
just google the default location for the apache config
apache2.conf ? @cold anchor
that sounds like the right file
then i'm doing something wrong
did you restart apache after editing that file?
is that the whole file?
you'll have to add it whereever you're handling the domain routing
is it possible to make my website autoreload when i make changes to the code?
i'm using flask
@native tide set the debug config variable to True
what does that do?
yup
guys this query get me the error "str has no attribute id"
posts = Post.query.filter_by(owner=user.id).all()
but i'm using owner that is declared int type and the id of the user that is also declared as int
solved
Can anyone help me with dual booting linux with windows
#web-development : Help with web technologies such as Flask, Django, HTML, CSS, and JS.
I know ...i asked in windows i got no response either
there are plently of tutorials on youtube
I saw many...but something is different in my case... It's not showing the unallocated partition
@supple loom if you didn't find the answer you can ask here https://www.reddit.com/r/linux4noobs?utm_medium=android_app&utm_source=share
It's a linux sub reddit I think they will help
How to consume your own rest api, within your flask web app? do code like this considered good?
@app.route('/hello/<name>')
def hello(name):
info = requests.get('http://localhost:5000/hello/'+name)
return info.text
hello i am using django restframework and trying to make a simple API.
I declared my models and serializers but i get an error.
my model
serializer
the error
the error says ArtWork object has no attribute arts even tho i have declared arts = ArtSerializer(...) and also passed it in Meta of ArtWorkSerializer
how can i save something like this as a static website for offline use? http://patorjk.com/software/taag/
Hello, are there React Pros here?
guys i should run a flask web app on a web app without SSH access, it is microsoft azure, so i cannot use the terminal to install gunicorn, and start it
is there a way to start the web app anyway?
hey, what is wrong in this chunk of code? ```html
<link rel="stylesheet" href="{ url_for('static', filename='signin.css')}" >
my css is not working at all
i have a bootstrap import above it and this,
the bs is via the link provided in the site, mine is from my machine, the folders are like
[static]
[css]
signin.css
You forget to put the css folder
<link rel="stylesheet" href="{ url_for('static', filename='css/signin.css')}" >
i guess i've tried that, but i'll do it again
if it's working, the problem is that it's not overwriting the bootstrap css
yup and if its not working I think you should restart the browser because this what I do so you press ctrl+shift+r
try to put it under the bootstrap link
it's already under :c
you saved the file?
wait
here's mine <link rel="stylesheet" href="{{ url_for('static', filename='css/signin.css') }}">
try this
maybe it will work i think you forget to put 2 {
wow
i guess
it worked
i'll try to overwrite some bs to see if it's really working
nice
how to use jinja to import just a chunk of code? like i dont want to extend
but idk what are the keywords
to search online
i want to make a file fonts.html
throw all my font links in there
and push it to the main 'base.html' file
https://mayank-aggarwal.herokuapp.com/
Hey guys,
Take a look at my web portfolio that I recently created.
Would appreciate any kind of opinions
nice website
Guys im making a project which scrape data from another website but at some point it freeze
and stop scraping/downloading
so is the problem from my pc or I have a mistake in the program but it work fine without error it just freeze and stop scraping?
or is it a problem from the website im taking data from becuase im sending too many requests?
It's probably a code issue
oh
are you sure because it download it normally but suddenly stop
the downloading process is too slow lol
It's possible you're getting stuck in some tricky infinite loop that you can't see. Or that you're scraping has somehow got you endlessly bouncing between two links. It seems unlikely to me that the code is just freezing - and if it is, its probably not freezing, just you're not accounting for some behaviour that you need to be. It's very difficult to provide help with actual code.
IF you're looking to debug, try removing as many factors as possible, then adding them back bit by bit til you encounter the problem again
#Get the html code & create beautifulSoup object
link = link
res = requests.get(link)
res.raise_for_status()
soup = bs(res.text,"html.parser")
#Get the folder name
regexName = re.compile(r'chapter-\w+\.?\w*/?')
regexFind = regexName.search(link).group()
print(f"This is it {regexFind}")
fullName = regexFind
#print(fullName)
if not os.path.exists(f'/tmp/server/manga/{folderName}/{fullName}'):
os.makedirs(f'/tmp/server/manga/{folderName}/{fullName}') #create the chapter file
imgElem = soup.select("body > div.body-site > div.container-chapter-reader > img")#Get the css selector for the manga image
print(len(imgElem))
for i in range(len(imgElem)):#Page loop
src = imgElem[i].get('src')
fullLink = src
print(src)
res = requests.get(fullLink)
animeFile=open(os.path.join(f'/tmp/server/manga/{folderName}/{fullName}',os.path.basename(fullLink)),'wb+')#file name
print(f'\nDownloading {fullLink}')
for chunk in res.iter_content(100000):#File download
animeFile.write(chunk)
animeFile.close()
print(f'\n{fullName} Is Done\n')
nextElem=soup.select('a.navi-change-chapter-btn-next')#Get the css selector for the next button
try:
href=nextElem[0].get('href')#Link for the next chapter
except IndexError:
flash("Thanks for using our website")
folderPath = f"/tmp/server/manga/{folderName}"
link=href
if fullName == chEnd:
flash("Downloaded files to the server successfully.")
zip_files(folderPath)
break
#link=href```
@rigid laurel thx... here's the code
I have a while loop but i don't think its the problem
because the problem happen inside the first for loop
why the hell does Jinja not put the super() block where you goddamn tell it to
it always puts the inherited stuff after
i mean come on
that's completely stupid
what possible advantage does that have
/rant
I am looking to integrate a rest API with a discord bot, but I am not 100% sure the best way to do it. Threading the Flask/Quart/AIOHTTP receiver really doesn't solve the issue of being able to communiate with the main thread where my bot it. Any ideas to point me in the right direction for reasearch?
is there anyone here who can help me with python
wrong channel?
oh 🙂
I am doing appointment application with python and I have all done except calendar. Is there ready to go django calendar package what let's you locate appointment with date & time
I have checked out FullCalendar, but it only let's you use the schedule if you share the source code.
guys how can i deploy my flask web app with build automation turned on 'ON'?
to make the system doing "install -r requirements.txt" automatically
@zealous siren thanks i noticed right now your reply sorry
btw what about the requirements?
azure doesn't have a SSH to do the command to activate the env or install the requirements
it has just a row to do the startup command
Everything to do with validation is server side
doesn't js do client side form validaiton?
You mean checking if a field is empty or like logging in.
Any rest api/API Projects
Easy
And I don't know the difference between rest and api
hello , i am beginner django developer and i got task to create datasource website (store data from excel and show on web with searches) , is that hard to accomplish using django ?
website eg. https://datasource.kapsarc.org/pages/home/
KAPSARC aggregated open data aligned to advancing your energy economics understanding and research
@native tide validation is always server-side
@solar hatch https://youtu.be/s7wmiS2mSXY
What exactly is an API? Finally learn for yourself in this helpful video from MuleSoft, the API experts. https://www.mulesoft.com/platform/api
The textbook definition goes something like this:
“An application programming interface (API) is a set of routines, protocols, and...
With flask
@solar hatch Flask-rest framework or just Flask without the framework?
Without
@solar hatch Try this assessment. It was for BUILDforSDG Andela https://drive.google.com/file/d/1UEPgYqd9Bjb1ZI6wKcu7V7KZglkHMjh4/view . It is a Covid-19 situation assessment API.
Create a weather app with Flask
In my Django Template, I am using {{song.books.all|join:"," }}, this is returning a list of books from each song. Each book has an endpoint but when I use <a href it hyperlinks the entire joined list of books. I would like to hyper link each book with it's own href. Anyway I can pass join with href?
Anyone?
@cloud path You need to build a container, put it in Container Registry then let Azure Web App pull the container down and run it
Azure has container registry and you can even build using Container Registry or build in Azure Devops or build inside your own build system and push to Azure Registry Container
I posted this in general; did not realise their was a specific channel.
Hi all, I'm new to Python. I am using Flask to create a small REST API. This REST API has a middleware where I want to add a header to the request to access it in the Resource (I am using Flask-RESTful). I get an error that the .headers is immutable... is there a way to create a new header, i.e. X-User-Id? Or, how would you pass something from a middleware to the Resource?
The middleware:
def user_id_header(f):
def get_and_load_jwk():
r = requests.get('http://oathkeeper-api:4456/.well-known/jwks.json')
key = r.json()['keys'][0]
jwk = JsonWebKey(algorithms=JWK_ALGORITHMS)
return jwk.loads(key)
@wraps(f)
def inject_user_id(*args, **kwargs):
token = request.headers.get('Authorization').split(' ')[1]
jwk = get_and_load_jwk()
sub = jwt.decode(token, jwk)['sub']
print(sub, file=sys.stderr)
request.headers.set('x-user-id', sub)
return f(*args, **kwargs)
return inject_user_id
in general you shouldn't be modifying the incoming request headers
the client sent you a request and you should honor (or not honor) what comes in, but you shouldn't modify it
if you want to use a "context local" over the period of processing a request, this is exactly what flask.g is for. in your case flask.g.current_user_id = sub and you can access flask.g.current_user_id anywhere in your code that is in the context of a request
Brilliant! I did not know Flask offered per request context.
Thanks @cold anchor
@cold anchor Is g an extra package I need to import?
Hello, I've been installed django. I have a probleme because when I use a command (ex: django-admin startproject) files are created but nothing is written in the CMD. Actually this becomes a problem when I try to do python .\manage.py makemigration or python .\manage.py createsuperuser ...
I had reinstall 4 times python switching between 3.7 and 3.8 and I don't understand the probleme.
If somebody have an idea I'm listening
nota bene : pip install ... has traceback
@spiral oak Can you try PowerShell?
It's probably an issue with your CMD not Python/Django, though.
it seems not, the power shell has the same issue
@spiral oak Can you post a screenshot?
is it better to use django or flask
im gonna be using a couple api's
and mySQL
Are you building API or consuming them?
then doing what with data?
do either, consuming APIs doesn't matter, you can do that with aiohttp or requests
don't even need Django/Flask for that
basically what im doing
i made a layout for myself, its the first time im taking on a challenge like this
i had an idea to make like a website you could go on, you would log in and you could get notifications from all of your applications
so like instead of going to every indivisual thing like gmail, and then insta, and then opening up snapchat
just as an example
if you click on any of the notifications it will direct you to the website
ok, so Flask is quicker to get going, Django more powerful
pick whatever poison you want to start with
ahh i see
anyone in here familiar with WP steam auth and tournamatch ? (for the wordpress)
im learning in that class right now @shy holly
@native tide nice
idk
Django
Do you guys know how to change a specific template,
I want to change the "change_list.html" template but only for a certain app
how I solved it :
{% if opts.app_label == 'MY APP NAME' %}
HTML CODE
{% endif %}```
guys
If I bought a domain
can I just use it on wordpress
or will it cost me a fee?
@obsidian parrot from my experience, if you are going to be making user accounts, I would suggest using Django
makes it much easier to also know Flask before learning Django
i'm starting next week at a new job, they use PostGresSQL and django, what are their strong point compared to flask and MySQL. What little project could i do, specifically to understand the strength of both of them, in a short time (5/10h? )
what problem do they resolve in other words
@gilded monolith I haven't used PostGresSQL or MySQL but I can give some basic advice on Flask and Django. Flask is a really good "microframework" that allows you to build simple websites fast. So you can build a website that does simple jobs, probably something like a page about yourself or something like that, nothing with user accounts and things like that. Django is a much more advanced web framework that simplifies making web apps a lot but also allows you to have a lot of control over it. I haven't used it much but it made having users on my page a lot simpler, because Django handles everything (hashing SHA-256 and salting) of passwords and it has an admin page to use to look over your page's details
I don't know if I am spreading misinformation but that is what I got from building a small website
It also uses sqlite3 for database management in a very simple way
But you can change that after starting your project
Yeah i already did smol stuff with Flask and such, i was just wondering what i should pay attention to and what knowledge to quick grab
hello everyone, currently building a Django webapp as a front end to my Postgresql database. I am using elastic beanstalk to deploy to AWS (the database also lives on AWS). The website works locally (it's just a simple table at the moment) but whenever i run eb deploy i get the following error:
2020-04-28 10:23:56 ERROR [Instance: i-0e140fa936b76bee1] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-04-28 10:23:56 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
I can't really seem to find advice online for this error, and have followed tutorials to get to this point (including the AWS guide). But I can't seem to figure it out. Is there some rookie mistake I am making here, looking for any help have been stuck for 3-4 hours on this.
I am currently working in Flask, I am looking for a way to serialize a SQLAlchemy model to JSON (to build an /api route). Anybody has any advice on best practices?
marshmallow is the standard for doing that https://marshmallow.readthedocs.io/en/stable/
Uhhhhh, I must be silly but in Django I am trying to give a rating to a book. I made a view that will create a rating for a book by passing in the current book, and a integer rating. This does work if I use rating/stars=5 but I want to populate this with the value from a select element. Does anyone know how to do this?
`<select id="rater">
<option value="1">1</option>
....
</select>
<a href="{% url 'books:submit-rating' bookpk=book.pk stars=5 %}" class='btn btn-success' type="submit">Rate Item!</a>
<a href="{% url 'books:submit-rating' bookpk=book.pk stars=rater.value %}" class='btn btn-success' type="submit">Rate Item!</a> `
your html request doesn't contain the selected value ? i had similar problem with flask because it was <select name="rater"> for some reason
not sure if i understand your problem and if that's gonna resolve it anyway :/
@gilded monolith I added form action before it - and it is processing now. However since there are several cards with the same form, it is only updating the first one....
is it bad to redirect an unsecure dns to a secure one?
Guys I made a flask chat website with flask-websocket and flask but when I deployed it to heroku it is unable to connect to it
Like the website loads
But the socket doesn't
And I can't send messages
The code looks like this :
from flask import Flask, render_template, request, make_response
from flask_socketio import SocketIO, send
app = Flask(__name__)
app.config["SECRET_KEY"] = "dsa987hda*&^SD*(Q*^Tia7sd"
socketio = SocketIO(app,cors_allowed_origins="*")
@app.route('/')
def index():
return render_template("index.html")
@socketio.on('message')
def handle_msg(msg):
send(msg, broadcast=True)
The HTML :
<html>
<head>
<title>Hello</title>
<script type="text/javascript" src="static/socket.io.js"></script>
<script src="static/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function () {
var socket = io.connect("https://chath2o.herokuapp.com/");
socket.on("connect", function () {
socket.send("User has connected!");
});
socket.on("message", function (msg) {
$("#messages").append("<li>" + msg + "</li>");
});
$("#sendButton").on("click",function() {
socket.send("User : " + $('#myMessage').val());
$('#myMessage').val('');
});
});
</script>
<ul id="messages"></ul>
<input type="text" id="myMessage" />
<button id="sendButton">Send</button>
</body>
</html>
WSGI.py :
from app import socketio, app
if __name__ == "__main__":
socketio.run(app)
In case you wanted to test it : https://chath2o.herokuapp.com/
does Heroku handle Websockets?
yes
Radarh2o, free Heroku?
I have a running socket server on Heroku (https://app.metrecord.com) and it's on a paid server, but even when it was free, I just had to set the socket disconnect/reconnect to be every 45 seconds instead of holding the connection because heroku stops it at 55 seconds
looks like a lot of 400s, might be good to check the logs
Heroku is just so limiting, it's sometimes hard to tell what's app and what's not
I mean like any alternative websites (Except pythonanywhere)
And it is paid?
yes
Isn't there free ones?
compute costs money
deploying to a different place won't get rid of the 400s unless they're caused by the infrastructure
which is unlikely
well, I assume it works locally
find the root of the 400s
And like no 400s
what 400 are you getting?
have you looked at the logs?
Yea
what do they say?
Wait I send it
2020-04-28T15:41:06.640684+00:00 app[web.1]: 10.11.150.203 - - [28/Apr/2020:15:41:06 +0000] "GET /socket.io/?EIO=3&transport=polling&t=N71SkoE&sid=e9ee2db286e940d2ab54ed454729aff5 HTTP/1.1" 200 39 "https://chath2o.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:76.0) Gecko/20100101 Firefox/76.0"
2020-04-28T15:41:06.542476+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=N71SknE" host=chath2o.herokuapp.com request_id=d67544f8-cafd-40e4-9b8f-df4777b4968f fwd="65.96.225.92" dyno=web.1 connect=0ms service=3ms status=200 bytes=375 protocol=https
2020-04-28T15:41:06.643429+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=N71SkoE&sid=e9ee2db286e940d2ab54ed454729aff5" host=chath2o.herokuapp.com request_id=5fec1b35-e7be-41ff-8824-84c5a88475c5 fwd="65.96.225.92" dyno=web.1 connect=1ms service=7ms status=200 bytes=258 protocol=https
2020-04-28T15:41:06.638383+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=N71SkoC&sid=e9ee2db286e940d2ab54ed454729aff5" host=chath2o.herokuapp.com request_id=c2f4a5c3-1f1d-49c2-9017-47a34dbc0a94 fwd="65.96.225.92" dyno=web.1 connect=2ms service=4ms status=200 bytes=266 protocol=https
2020-04-28T15:41:18.606198+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/socket.io/?EIO=3&transport=polling&t=N71SYoM&sid=37cd16e0033e4e77af9f6e6f2e66b738" host=chath2o.herokuapp.com request_id=49924344-ed06-4448-8f70-c4cacefbd6f1 fwd="108.18.36.173" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https```
And
The error :
Failed to load resource: the server responded with a status of 400 (BAD REQUEST)
In the console
of the browser
And it keeps trying to connect and spams "User has connected" (It reconnects every 10 secs
)
my guess is Heroku Load balancer is getting mad
lower time as baker suggested
Should I try connecting Javascript's socket to domain IP?
it might be worth following this project template https://github.com/sandeepsudhakaran/rchat-app
especially the Procfile
hmmmmm
I'll try the Procfile
And btw
The site ip has the same port as a normal flask app? (5000) or 80?
heroku will always give your site ports 80 and 443
Oh
I mean what could be the problem? Heroku or the code?
Cause the code works perfect locally
what happens if you get 2 in binary 😳
But when I deploy it doesn't connect to flask-websocket
that's what happens when you use free
Maybe
it's pretty sweeping to say this is caused by using the free tier vs the complexities of deploying to a remote server
what's your procfile?
how come my main domain is protected and my subdomain isn't
i am using a loadbalancer :)
that's #414737889352744971 questions and it's because DNS
the certificate should protect all subdomains
no
?
the certificate may or may not protect all subdomains, and again DNS can bite you
welcome to my world
Hello guys, do you need to host your flask app easily ? https://docs.qovery.com/guides/tutorial/deploy-flask-with-postgresql/
Hey @glass sandal!
It looks like you tried to attach file type(s) that we do not allow (.txt). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg.
Feel free to ask in #community-meta if you think this is a mistake.
Tried installing geventwebsocket and got :
remote: ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l39jxgzd/geventwebsocket/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l39jxgzd/geventwebsocket/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-zi7pewjq/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/geventwebsocket Check the logs for full command output.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to chath2o.
remote:
To https://git.heroku.com/chath2o.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/chath2o.git'
And before that :
remote: command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l39jxgzd/geventwebsocket/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l39jxgzd/geventwebsocket/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-zi7pewjq/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/geventwebsocket
remote: cwd: /tmp/pip-install-l39jxgzd/geventwebsocket/
remote: Complete output (14 lines):
remote: running install
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-install-l39jxgzd/geventwebsocket/setup.py", line 47, in <module>
remote: 'geventwebsocket = geventwebsocket.cli:cli',
remote: File "/app/.heroku/python/lib/python3.6/distutils/core.py", line 148, in setup
remote: dist.run_commands()
remote: File "/app/.heroku/python/lib/python3.6/distutils/dist.py", line 955, in run_commands
remote: self.run_command(cmd)
remote: File "/app/.heroku/python/lib/python3.6/distutils/dist.py", line 974, in run_command
remote: cmd_obj.run()
remote: File "/tmp/pip-install-l39jxgzd/geventwebsocket/setup.py", line 20, in run
remote: raise Exception("You probably meant to install and run gevent-websocket")
remote: Exception: You probably meant to install and run gevent-websocket
Django
What is the normal way of populating fields in your model that are not reliant on user input, but on some calculations or references.
I "solved" it buy building an __init__ function, but for some reason that messes with the Inherited Models class ...
Is there a default other way, or is there something that im missing ? (Couldnt get the super().__init__ to work either)
def __init__(self):
self.pc_slug = self.pc_name.replace(" ", "-")
self.pc_hpMax = self.calc_modifier(self.pc_con) * 20 + self.pc_race.race_hp
self.pc_init = self.calc_modifier(self.pc_rfx) + 6
self.pc_speed = self.pc_race.race_speed
self.pc_carryMax = self.calc_modifier(self.pc_str) * 5 + self.pc_race.race_carry
File "./main.py", line 7, in <module>
from app import crud, models, schemas
File "./app/crud.py", line 3, in <module>
from . import models, schemas
File "./app/schemas/__init__.py", line 1, in <module>
from .item import Item, ItemCreate, ItemInDB, ItemUpdate
ModuleNotFoundError: No module named 'app.schemas.item'
i am getting this error while i have no such schemas in my schemas.py file
named as Item or ItemCreate and the rest
this is an fastApi issue
Guys can someone explain me why do we use api ?
I mean like ok I've sent JSON data to server and got a JSON response . So why is this thing so used?
And can you give me real life examples
@onyx crane There's some docs which may be relevant to your question I think (https://docs.djangoproject.com/en/3.0/ref/models/instances/#django.db.models.Model)
Oh damn ! thx!
Unfortunately I am not sure about the internals. For that you might have to look at how Django handles all of this and what it uses __init__ for. Or wait for someone who knows better to respond! 😛
this works great if youre not planning to use the admin panel :D
@supple loom do you have something called item defined somewhere - a file, function?
@glass sandal Social media API is one good example. Let's say I asked you in how many of Guido's tweets does he mention the word Python.
- You could literally scour his Twitter page and count
- You could build a scraper that looks at the page and count
- You can hit the Twitter API, collect all tweets, and count
API solves this one way of interfacing with data - where you want to this data over a period of time.
API can also help centralise data from distributed sources. Let's say COVID-19 data in the US. If you were interested in data from different states and there isn't one built on the Federal level, you could have an API interface that allows you to query state-level data, while in the backend of that API queries individual states.
Rader, containerize it and find out
@outer apex no i don't ...i had (but i changed) in my schemas file before but not all of the above mentioned....so i don't think it's related.
paste.pythondiscord.com/kawezinoye.py
this is my schemas file
File "./app/schemas/init.py", line 1, in <module>
check this line ..i have no init file either
what's your directory structure?
C:\Users\prashant\Desktop\india_scanner\app\IS\backend\app
this is where the main file lies
C:\Users\prashant\Desktop\india_scanner\app\IS\backend\app\app
and this is where schemas and other files lies
@supple loom perhaps this SO response might be helpful
https://stackoverflow.com/a/45556023
https://discordapp.com/channels/267624335836053506/366673702533988363/704759938068643901
omg thx for your explanation
this is not necessarily python. But I was wondering if there is a way to see if a user copied (Ctrl C) a line from a website
I don't want to force them to copy to clipboard
but at least see what % of users are copying said code
is this possible at all?
Looks like this SO answer gets into how to detect ctrl+c https://stackoverflow.com/questions/10827256/how-to-detect-copy-and-paste-in-javascript
You might want to use that to detect it and then when it happens, save that a user copied some text
the question is the same as mine. but the answer is how to disable that functionality
I wonder if it is just not possible
ok so use that answer for the "detect if they did ctrl+c" and use this answer for "what does the user currently have highlighted" https://stackoverflow.com/questions/4712310/javascript-how-to-detect-if-a-word-is-highlighted
I'm writing a Firefox addon that is triggered whenever a word is highlighted. However I need a script that detects when a word is highlighted, and I'm stuck. An example would be nytimes.com (when y...
ahh. thanks @cold anchor
In what folder would you guys put a django install in server side? Some people said to make a new directory called /srv
I wrote a extremely simple rest framework that only supports json format! You can check it and give me ur thoughts https://gitlab.com/PanTrakX/rstx
Hello, I was wondering if theres a way to have a variable for a <img> tag, instead of an absolute url, without using js
@native tide can you explain further what you want to do?
I'm creating a leaderboard on my webpage that auto updates user rankings, & I need the <img> section of a table to update to whoevers in 1st place in the DB..
Hence why I need a way to change the <img src=> link
Oh okay you want to programmatically change the URL value of src in an <img/> tag
Mhm
Are you using Django or flask to serve this HTML?
Django
So in your template can you set the value of the src attribute to be variable you pass into the template when you render it?
I was trying to use jinja syntax to input a link from a SQLite DB in the img field
<img src={{user.Discord_Avatar_URL}}> which obviously won't work because it just wants a string URL
Just tell what's up
Hi I am a newbie in python and web development I encountered a problem and its been couple of hours now 😕 . Hope someone can help or lead me to the answer 🙂 thanks in advance! Here's the error I get. screenshot
Virtualenv name: blog
forms.py
flaskblog.py
flask.cli.NoAppException: While importing "flaskblog", an ImportError was raised:
Traceback (most recent call last):
File "c:\users\avalgp\documents\flask_blog\blog\lib\site-packages\flask\cli.py", line 240, in locate_app
import(module_name)
File "C:\Users\avalgp\Documents\flask_blog\flaskblog.py", line 2, in <module>
from forms import RegistrationForm, LoginForm
File "C:\Users\avalgp\Documents\flask_blog\forms.py", line 3, in <module>
from wtforms.validators import DataRequired, Lenght, Email, EqualTo
ImportError: cannot import name 'Lenght' from 'wtforms.validators' (c:\users\avalgp\documents\flask_blog\blog\lib\site-packages\wtforms\validators.py)
I tried to reinstall flask-wtf and see if that helps but this is what I get. I tried to google it but when I started reading through their answers I get lost more. 🥴
All good I somehow managed to make it work 😄
how do you get the info of a selected record in the admin panel of django?
https://ibb.co/QjPhbXq
im not sure what youre asking
what is the "info"
and where do you want to get it to ?
like I want to get the selected users id , name , email ..etc
and where do you want to get it to ?
@onyx crane I'm trying to make a function that uses these "info" in something when a button is clicked
perhaps an action
Youre trying to access the stuff from code => youre not accessing it through the admin panel ...
If you click on the Blue Links in the Admin Panel you can see all the columns ... if thats what you mean.
Youre trying to access the stuff from code => youre not accessing it through the admin panel ...
@onyx crane right
I've a button when this button is clicked I want to get the selected users
Where do you have this button ?
Can you explain me what youre trying to do ?
I think youre missing something major here
in this template "change_list.html"
Ok. The Admin panel, and the selections you do in it, have nothing to do with what youre trying to do.
You want to display all instances of a specific Model in a template ?
nope I want to get the instances of a specific model bec I need the user id to use it in Google API
You just said no and then repeated what i asked ...
sorry
from .models import Yourmodel
def testview(request):
return render(request = request,
template_name='appname/yourtemplate.html',
context = {"yourmodel": Yourmodel.objects.all})
and how do I filter by the selected ones ?
@outer apex i was getting that error coz i had a folder in the same directory with the same name as schemas
yourtemplate.html
<body>
{% block content %}
{% for modelinstance in yourmodel%}
<p>{{modelinstance.columnname}} </p>
{% endfor %}
{% endblock %}
</body>
see if you get that too work
and display your model instances (users?)
Anyone know how i can use Flask/Django to extract the HAR file of people visiting my website?
@onyx crane
class ClassesAdminENG(DjangoObjectActions,admin.ModelAdmin):
def testview(request):
all_personalInfo = StudentsEng.objects.all()
return render(request=request,
template_name='admin:students_studentseng_changelist',
context={"infos": all_personalInfo})```
inside changelist.html:
{% for modelinstance in infos %}
<p>{{modelinstance.name}} </p>
{% endfor %}```
unfortunately it didn't display anything
that worked :
response = super(ClassesAdminENG, self).changelist_view(request, extra_context)
all_personalInfo = StudentsEng.objects.all()
extra_context = {
"infos": all_personalInfo,
}
response.context_data.update(extra_context)
return response ```
now let's go back to the main question
Whats the best way in Flask to call a template and pull in a python variable from a list in the app to populate the webpage? For example, I have a list of lists with each list containing details I'd like to populate a webpage with. How do I efficiently call and populate the template for each list? Bonus points for how I do this as a hyperlink on a homepage
have a route.
route has data from (form?, db?, config file? variable?)
route does its job and calls the template passing in the req'd variable
route needs to accept GET and POST
GET then nothing has been submitted so just display the default behavior
POST then a link has been clicked that has ? in the URL so you can now have your route process the POST action
.lds-roller {
display: inline-block;
position: relative;
width: 80px;
height: 80px;
}
.lds-roller div {
animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
transform-origin: 40px 40px;
}
.lds-roller div:after {
content: "";
display: block;
text-align: center;
position: absolute;
width: 7px;
height: 7px;
border-radius: 50%;
background: black;
margin: -4px 0 0 -4px;
}
.lds-roller div:nth-child(1) {
animation-delay: -0.036s;
}
.lds-roller div:nth-child(1):after {
top: 63px;
left: 63px;
}
.lds-roller div:nth-child(2) {
animation-delay: -0.072s;
}
.lds-roller div:nth-child(2):after {
top: 68px;
left: 56px;
}
.lds-roller div:nth-child(3) {
animation-delay: -0.108s;
}
.lds-roller div:nth-child(3):after {
top: 71px;
left: 48px;
}
.lds-roller div:nth-child(4) {
animation-delay: -0.144s;
}
.lds-roller div:nth-child(4):after {
top: 72px;
left: 40px;
}
.lds-roller div:nth-child(5) {
animation-delay: -0.18s;
}
.lds-roller div:nth-child(5):after {
top: 71px;
left: 32px;
}
.lds-roller div:nth-child(6) {
animation-delay: -0.216s;
}
.lds-roller div:nth-child(6):after {
top: 68px;
left: 24px;
}
.lds-roller div:nth-child(7) {
animation-delay: -0.252s;
}
.lds-roller div:nth-child(7):after {
top: 63px;
left: 17px;
}
.lds-roller div:nth-child(8) {
animation-delay: -0.288s;
}
.lds-roller div:nth-child(8):after {
top: 56px;
left: 12px;
}
@keyframes lds-roller {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
``` whats up guys, This is a 3 dot css animation I did'nt create it I just get it from another site ..., how I can put it in the middle of the page?
I tried text align but its not working
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}```
Thanks but what prefixes are I don't know much about css?
@versed sigil thanks, this helps! Is there good tutorial to follow to make sure I do this correctly?
I feel so stupid and cannot find a answer for this, I am making a postage tracker, I am making a get request to this url https://www.fastway.com.au/tracking-api/?callback&LabelNo=<LABLEGOESHERE>&dataFormat=json
I can parse the tracking numbers perfect but not to were I want it to go.
if I can just get an explanation do not have to be told exactly I have tried, a few diff ways and cannot seem to get it to work.
hey guys, i'm using flask-login and i'm struggling a little, i am getting this message when i try to login.
my dashboard has an @login_required below the route
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
username = request.form['username']
password = request.form['password']
user = User.query.filter_by(username=username).first()
if not user or not user.check_password(password):
flash("not successful.")
return redirect('/login')
else:
user.is_authenticated = True
login_user(user, remember=True)
return redirect('/dashboard')
else:
return render_template('login.html')
this is the login code
i tried some alterations but had no success
anyone here familiar with Django? I am trying to make model form but not sure if i need to incorporate a formset using two different classes of models
is there anyone interested in joining a personal private github project? We are 3 developers, 2 moviemakers and one CEO. We're building a live streaming progressive web app and we're aiming to become a startup in the future.
any developers interested and looking for experience would be really appreciated. It's Laravel, Vue and Livepperjs
so ive got an issue here,
@app.route('/api/servers', methods=["GET", "POST"])
def setstatus():
if request.method == "GET":
print(serverList)
return jsonify({
"servers": serverList
})
elif request.method == "POST":
servername = request.headers['servername']
serverip = request.headers['ip']
servermap = request.headers['map']
serverport = request.headers['port']
serverid = id_generator()
server = {
"ip": serverip,
"port": serverport,
"name": servername,
"map": servermap,
"id": serverid
}
serverList.append(server)
print(serverList)
return jsonify({
"res": "OK",
"server": server
})
I can only see the changed serverList array in the elif and nowhere else. serverList is like so: serverList = [] at the top of the file. In the GET request, it only returns { "servers": [] } and I don't know what to do. Thanks!
@inland fossil you need to save it somewhere if you wanna access it later
i have
but i found the issue, for some weird reason, it cant read the serverList that I have defined earlier up at the top.
well, i can't see where you defined it
from flask import Flask, render_template, jsonify, request
import socket
import time
import atexit
import random
import string
import requests
from apscheduler.schedulers.background import BackgroundScheduler
app = Flask(__name__)
def isOpen(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
before = int(round(time.time() * 1000))
s.connect((ip, int(port)))
after = int(round(time.time() * 1000))
s.shutdown(2)
return True
except:
return False
serverList = []
def getPing(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
before = int(round(time.time() * 1000))
s.connect((ip, int(port)))
after = int(round(time.time() * 1000))
s.shutdown(2)
return after-before
except AssertionError as error:
return error
...
def check_all_servers():
statusCheck()
for server in serverList:
if isOpen(server["ip"], server['port']):
return True
else:
serverList.remove(server)
return False
def id_generator(size=12, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
check_all_servers()
scheduler = BackgroundScheduler()
scheduler.add_job(func=check_all_servers, trigger="interval", seconds=3)
scheduler.start()
# Shut down the scheduler when exiting the app
atexit.register(lambda: scheduler.shutdown())
right in the middle
As I undestand it, HTML, CSS and Javascript are often used together. I think I need HTML to view code in CSS or Javascript, but should I learn either Javascript or CSS first and then the other, or is it reasonable to try and learn both at the same time? I already know some Java, so I'm guessing Javascript is the better one to start with if I'm doing one at the time.
@short escarp youre going to need to understand HTML DOM and CSS sectors are a minimum to get started with javascript.
well I mean you can get started with javascript w/o knowing those to learn the syntax, but the real power of JS is when you start manipulating the DOM
@short escarp lets say html lets you add your text, videos, links, images. Css lets you style that stuff. (color in text, add margins left right and center and position your stuff.) Javascript then on top lets you put logic for your website or any kind of functionality. You press a button and something is supposed to happen. Javascript. You want to transform something. Javascript. And basically everything else.
Django:
- When i use the .save method of my ModelForm, i think the .save method of my reference Model gets called.
I already overwrote the save Method of my Model which worked perfectly. Now i want to make the ModelForm call a "first_create" method that is an extended version of my overwritten .save method of my Model. This does not work though.
Hi, how can I create checkbox which works dynamic in Django. Like when I click that check box it should strike some text.
are there any good tools that will help me make a front end of the website (HTML, CSS, JavaScript) and then let me tie in my python code for the back end and database) I saw Bootstrap Studio and it seems nice, im willing to buy something
there are many many good free templates available. You find one you fancy, download it and then change it to suit your needs. Flask is easy enough to use with its Jinja templating engine to connect python to your front end
@round ferry you need to use client side javascript for that
im looking for a program really that is drag and drop that then gives the source HTML code
then youre out of luck as far as i know.
get the free template
edit to work with flask
what it sounds like youre really needing is a simple site that something like squarespace provides
you should look at that @thorny rover
does square space integrate well with stuff like flask?
I have a HTML report which autogenerates every time I change the analysis, which I have open in a browser window.
However, the browser window doesn't automatically update when the file on disk is updated, is there a straightforward approach to make this happen?
all of the work is local
you could use websockets to tell the page to reload
@elfin lance what do i need to google?
it depends... As I only sent an abstract solution
the workflow is - working in a python notebook, on save html report is generated, report is open in browser, i have to refresh browser to see changes
@elfin lance there's some context
does it have a server or do you just open the html?
I don't think there is a way to check for changes and reload totally on the client side
that's a shame
fair, i figured it might be something that people did when working on web stuff
locally at least
Is it possible to make role system with flask, and display some things only to people with certain role?
@fickle fox flask-security (https://pythonhosted.org/Flask-Security/) provides role-based protection to views if that's what you mean
@versed sigil Oh!
I think thats it, thanks @tender crater
Are there any good tutorials/books that focus on application design and infrastructure considerations for scaling to huge numbers of users?
Production Ready Microservices by Susan Fowler http://shop.oreilly.com/product/0636920053675.do - the concepts apply to non-microservices as well
Release It! by Michael Nygard https://pragprog.com/book/mnee2/release-it-second-edition - dives into all sort of crazy problems and patterns/anti-patterns of production software services
@lofty matrix If you have a lot of users, you need to load-balance
gang war
For a web site, this can be done with multiple methods
A good setup for scalability: One DB Server, one app server, one load balancer. The load balancer acts as reverse proxy. Something like haProxy.
I can't figure out how to go about this in a CSS file. I can only get it to work using inline style attribute on HTML elements.
background-image: url( {{url_for('static', filename='/img/image.png') }} );
Just doing the path normally doesn't seem to want to locate the static files.
You can multiply this setup as often as you want, at a certain point, put another load balancer in front of the whole shebang
Thanks, for the info. Currently using a load balancer. I have some weird use cases that I was hoping to find patterns for
I'll bookmark those books rdbaker. Thanks 🙂
@native tide This needs to be relative to the css file
@native tide https://stackoverflow.com/questions/5815452/how-to-use-relative-absolute-paths-in-css-urls
I have a production and development server.
The problem is the directory structure.
Development:
http://dev.com/subdir/images/image.jpg
http://dev.com/subdir/resources/css/style.css
Production:...
thanks. Maybe its not an option then, because I use it at so many depths in the tree. Lemme read