#web-development
2 messages Β· Page 96 of 1
@viscid roost And then angular on the front-end?
Yeah
No worry
For frontend, do you generally go with a server or a static site solution? (say, netlify)
Angular is amazing.... I also tried react.... But Vue is better than react
I liked Vue best when scoping each one out.
Bro we connect frontend with backend
What's angular?
a frontend framework
It's a front-end framework.
FF
FEF
Never mix Frontend and Backend
What???
Code portability
I just wanted to see what you're getting at.
for small things
I understand the rationale.
having two separate codebases can be unneeded overhead.
But there are some cases where it's easier not to fully separate.
It didn't mean to code bases
I mean all the server side in Django
All the Frontend code in Angular
Android in Kotlib
Windows, IOS Flutter
Portability comes into picture when we're dealing with a product-based solution (say you want to deploy it as an entire application, like Jira/Confluence). But if you're offering cloud-based services (say gmail), then it's a general idea to keep the FE & BE separate
Okay, so there's always a place where the front-end and the back-end have to meet, though, so I think there's a little ambiguity.
Hey but you can never connect Django + Angular
Even there's a movement going on for something called microservices where you want your product to be scalable at web scale
just Like Html in templates in DJango
Not sure what you mean.
Have you used Django
of course.
well, you would have to do that in your template language.
anyone that does web dev
Jinja?
do you have to call a js function in an HTML tag for it to run?
something like this
{ % for some in somehintg %}
<p> {{ some }} </p>
{% endfor %}
you can't use this in Angular
@plush fjord No, the Django template language, which IS similar to Jinja, though.
@viscid roost Of course you can't.
Yeah... that's what I am saying
@topaz widget what you think?
@topaz widget okay. I'm more of a Flask guy so that's what the first thing came to my mind. Never worked with Django...
Angular and Django rest framework are different we then connect it
@viscid roost But you CAN hybridize it.
@white spruce Everyone wants to know ASAP. You're not paying us so have a little humility.
Never....
my bad @topaz widget never meant it that way actually
The answer is no.
just meaning, I wanted to know because I am on a project and time was running out
hybridizing means slowing the performance
never meant it like that
You call the HTML element in the JS, it's the other way around.
Yeah....
But not in Django.... You have to pass data
first in Angular
Then use TS
to show data
@viscid roost Yes, it's probably not best to hybridize, but it IS possible to do that.
so if you don't got a function name within a tag when you run the code js code, is it that it wont work?
@topaz widget
@white spruce I don't understand what you're asking, but you need to query the HTML element in the JS.
he said if u dont have a function name when u run the js code it doesnt work?
@viscid roost bye if you're leaving.
roman, I am asking if you don't got a function name within a tag when you run your js code, would it work
yes it can
Functions don't necessarily need names in JS.
if you add event listeners to it
() => { ... } is an anonymous function
@topaz widget out of curiosity, what's your largest project?
Probably my website.
I did write a program that automatically generates a website from a template, too, and that's pretty large.
Well, maybe not that large in absolute terms.
your website uses Django?
@topaz widget I think what they meant is suppose you have <p>This element isn't bound to any Javascript function</p>, but they still want to execute Javascript code on this p tag.
Then they need to either give the p element an id or query it in some way.
yes, they need an event listener
Yes, my website uses Django @vestal hound
You can check out my website, but there is a lot you won't be able to see right now, as the users section is walled off.
Keep in mind the landing page is a little old.
(home page)
wow this looks really good. This is actually one of the few websites that actually rendered on my tablet even though it's Javascript heavy.
@vital hare the js is really messy if you decide to look into that.
@versed python Thanks, yeah, I took some time to make sure it worked on most devices.
what UI framework did you use?
all the css is written by you??
Yes lol
I'm impressed
I wanted to learn CSS well so I made it from scratch.
This was before I really knew how to use flexbox, though.
it does look a bit dated, but if you made everything from scratch
that's mega impressive
mind blowing
Here, you can check out a page that isn't linked, too.
Yeah this looks really good
so @topaz widget to make my question clearer, do I have to put the js calling function inside a html tag for it to work?
minor suggestion
https://perasperadesign.com/extras/sudoku/
Not as impressive in the UI, but I did write the sudoku solving algorithm myself.
whoops
I don't think it was clear enough
maybe take out the shadows for the headings under "services"?
sorry, wrong link
@vestal hound I just added a whole user authentication system. The next step is to spruce up the home page.
@versed python If you got a 404 for signup page, that's intentional btw.
It's not open to users right now.
user accounts*
yeah I get it
@vestal hound So you think the shadows are heavy under the different service titles?
or the main one?
@vestal hound So you think the shadows are heavy under the different service titles?
@topaz widget this
Okay, thanks. Good feedback.
No, it's good feedback.
I agree it doesn't look quite as fresh as some newer websites out there.
Here, actually, if you want to see something newer, here is another page that's not linked:
part of that, though, is because many new websites use frameworks
so everything built with a framework, in some ways, looks the "same"
and since yours isn't, it will look subtly unique somehow
Right.
at least, that's my guess
okay I think the main thing
on that page
is the fonts
That was kind of the idea actually. To make it subtly different and also learn JS and CSS by trial of fire.
which one?
https://perasperadesign.com/extras/experiments/social/home/
@topaz widget this
okay, cool. Good feedback. Work in progress / experimental design study.
Did you guys test the sudoku solver?
my teacher is saying we got to make this tic tac toe game and he gave us the html and css file but he said we can't modify it
we just got to modify the javascript file
is this possible?
@versed python what would I have to do, he say we can't touch the index file
http://www.websudoku.com/?level=4 This one is best actually
use Javascript then
we just got to write the js
so I can write a function in js and also call it in js?
no html tags required?
@white spruce I assume the stuff he gave you will do what you need it to do.
Does the html your teacher gave you also include the tic tac toe board?
yes Ignis
how we write the code here again
i'll show the code
what do I write before I place the code
is it ''' code?
!code
Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.
To do this, use the following method:
```python
print('Hello world!')
```
Note:
β’ These are backticks, not quotes. Backticks can usually be found on the tilde key.
β’ You can also use py as the language instead of python
β’ The language must be on the first line next to the backticks with no space between them
This will result in the following:
print('Hello world!')
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>INFO2180 - Tic-Tac-Toe</title>
<link rel="stylesheet" href="tic-tac-toe.css" />
<script src="tic-tac-toe.js"></script>
</head>
<body>
<h1>Tic <span>-Tac-</span> Toe</h1>
<div id="game">
<div id="status">Move your mouse over a square and click to play an X or an O.</div>
<div id="board">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div class="controls">
<button class="btn">New Game</button>
</div>
</div>
</body>
</html>
so he gave that for html
and he gave us the css
now he want for us to write the js to make this work
and we can't touch this html file to write any of our functions there
i am not that good with js, but you'll probably need to target the div with #board, add an event listener to it and then determine which child divwas clicked. Once you have determined that, you can use Javascript to show a X or O inside as required.
@topaz widget we literally started learning javascript yesterday lol
take time with me man
damn
So when is this due?
on sunday
yeah, university stuff
computer science?
just use event listner for getting data of what user has inputed
plus I got networking courses which is fking difficult a lot of other stuff
yeah
computer science
What year are you?
F
2
Okay, maybe it's not that crazy. That's pretty aggressive, though.
man I am trying my ass off lol
I don't know why they use divs for the board. I'd have used a table element.
I be feeling loss sometimes lol, gonna go look at some js resources
Do the divs go left to right top to bottom or top to bottom left to right?
I assume the former.
@white spruce Do you know how to use document.querySelectorAll?
they started learning yesterday, i doubt it
I saw that before
maybe if I look more into it
seems like I am fked with this one
yeah it's pretty easy though, and it'd solve your problem easily
so start with that
anything else?
I am gonna stay up all night
and try to figure this out
anything else that would be good to use?
Okay, then you should use const cells = document.querySelectorAll('#board > div'); to get all the squares. @white spruce
That would be the first thing I did.
okay @topaz widget thanks for the start man, really appreciate that
Then you can loop through that node list it returns.
Works a lot like an array but is a little different.
lol I could write this whole program in an hour or less probably, but I probably shouldn't do your assignment for you.
lol
Add event listeners to each cell to work on a 'click' event.
Change the innerHTML attribute when clicked.
you can just tell me some of the stuff I may need and I see what I can do, and maybe you can help me correct some of my BS that I will be writing π
I'm telling you the broad strokes right now.
I think this is actually giving me the ideas though no cap
hope I will be able to put this together
when three cells in a row have the same character, stop the game and declare a winner.
I don't see how you submit a move.
I was just looking at the html
I think you need more html elements.
huh
i guess a click event for submit would be a good idea
no, it would fuck up.
Okay, then you need somewhere to click to designate that you've made a move otherwise this assignment is fxcked.
wait, nevermind
Okay, I see how you do it.
It just alternates between moves
man let me open word and start writing down these tips
So you might want a global boolean variable then that you toggle with each click.
var isX = true;
when false place an "O"
aite, gotcha so far
then you just need to toggle isX every click.
Part of me just wants to do your assignment for you lol but that would not be good, so sorry, I'm not going to do it.
Kl, sounds like I can get somewhere so far π
I gave you most of the broad strokes.
@import url('https://fonts.googleapis.com/css?family=Titan+One&display=swap');
:root{
--black: #1a202c;
--lightGrey: #edf2f7;
--grey: #cbd5e0;
--coral: #E57996;
--lighterBlue: #32ABE1;
--lightBlue: #3182ce;
--green: #42B883;
--defaultFontFamily: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;
}
body {
font-family: var(--defaultFontFamily);
background: var(--lightGrey) url('tic-tac-toe-bg.png') repeat top left;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: var(--black);
}
h1 {
color: var(--lighterBlue);
font-family: 'Titan One', var(--defaultFontFamily);
font-size: 48px;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
h1 span {
color: var(--coral);
}
#game {
display: flex;
flex-direction: column;
align-items: center;
}
let me drop the css if you don't mind LOL
.controls {
margin: 20px 0;
}
#board {
display: grid;
grid-template-columns: repeat(3, 150px);
grid-gap: 20px;
}
#status {
font-size: 24px;
margin: 20px 0;
text-align: center;
background: white;
max-width: 490px;
padding: 1rem;
box-sizing: border-box;
border-top: 4px solid var(--lighterBlue);
border-radius: 5px;
}
#status.you-won {
color: var(--green);
border-top: 4px solid var(--green);
font-weight: bold;
}
#status.you-won::before {
content: 'π';
display: inline-block;
margin-right: 8px;
}
#status.you-won::after {
content: 'π';
display: inline-block;
margin-left: 8px;
}
.square {
background: white;
border: 1px solid var(--grey);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
border-radius: 10px;
width: 150px;
height: 150px;
font-size: 96px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
}
.square.X {
color: var(--lighterBlue);
}
.square.O {
color: var(--coral);
}
.hover {
background: var(--coral);
border-color: var(--lighterBlue);
cursor: pointer;
}
.hover.O {
color: white;
}
.btn {
color: white;
background-color: var(--lighterBlue);
border: 1px solid var(--lighterBlue);
display: inline-block;
font-weight: 400;
text-align: center;
vertical-align: middle;
padding: .375rem .75rem;
margin: 10px 0;
font-size: 1rem;
line-height: 1.5;
border-radius: .25rem;
}
.btn:hover {
background-color: var(--lightBlue);
border: 1px solid var(--lightBlue);
cursor: pointer;
}
all the help will be appreciated, you don't even got to show me lol
I'm going to put this in a document. hol up. I want to see what this looks like.
okay
got to watch me some javascript videos now to see what's up
already found out how the query selector is gonna work π
Is there any more CSS?
@white spruce So are you supposed to style the board, too? Because when I open that html file with the css the board isn't shown.
he said we can't touch the CSS or HTML so I don't think so
that's actually all of it
hm
let me know if I'm fked π
When you open that in a web browser, do you see a tic-tac-toe board?
Yeah, he needs to write css for the board then or you do.
Okay, so you have to modify the style property of those elements then.
That makes sense actually.
So you have to change the style properties of all those elements you got with the querySelectorAll
yes
man I am starting to feel like this is a lot
okay
thanks
for a beginner
dang, he being so difficult
You need to do that when new game is clicked.
okay awesome, got that
This is kind of a tough assignment for someone who just started learning JavaScript.
I guess since you're second year, though, you already know a bit about programming, though.
What's the biggest thing you've built?
well we did a software in java for customer invoices when a customer purchases an item
that's biggest
like a cash machine pretty much
and we ended up not having to complete it because of covid, so it was difficult to adjust
but I still got me an A π
yeah
ah, interesting.
gave me a hard time though, we would go to lab though
for the seniors to help
but covid messed that up
Not that this is a good metric for project difficulty, but how many lines of code was it?
let me see if I can find the project and check
so after adding up every class @topaz widget it was about 700 - 800 lines
lol
it happens.
dude leaves his laptop and projector 3/4 of the classes
lol
he a old man though
so I guess it happens
So, not to flex, but how many lines of JavaScript would you guess that web page I showed y'all has?
actually it has too many lines, so it's not a flex at all.
idk, its a nice website though
thanks @acoustic oyster
that navbar animation is realllllly smooth
It's got over 1,000 lines of JS for that home page LMAO
None.
my god sir
lolol, nice, dang. You are braver than I xD
Yeah, it was my first website with JS I wanted to learn so didn't use a framework.
I am using frameworks nowadays but still writing a lot of custom JS.
dang !
I cant get over that navbar animation
Thanks, yeah, I thought that was pretty nice. The nav bar eats up A LOT of lines of JS.
yo bro, it's mad smooth
Too many actually.
My JS skills have improved since I made that page, and I could probably take 200 lines out.
lol
at least.
is that lightbox/carousel all vanilla? I want it xD LOL
yow man throw me some resources, that will give me a good start for this assignment lol
because I am at undefined as you said
lol
It's a better idea to learn the js part for your website first though
Styling will come later, the core functionality is what matters more
yeah
@white spruce You know you can actually see the contents of JavaScript files, right?
yeah science
So if you like my website, you can just open the JS files.
I'm warning you, though.
lol
The JavaScript is the work of an ambitious noob.
Meaning it is gonna be crazy to look at.
The JavaScript on my site will probably make your head spin. That's an insult at me if anything, too, for writing kind of sloppy code.
Yeah.
man that's nice
Like I said, I could write that a lot better now.
Here, you can see a newer project of mine, but it's not a responsive web page, meaning you need a viewport larger than 1200px to see it properly.
I don't mind let me see
Thanks.
The JavaScript is cleaner on that page, but probably still a bit messy.
I also used Vue a little bit.
a couple months ago
I have a newer page, too, but it's a little more perfunctory and has some sensitive information, so I'm not going to show that, sorry π
If the sensitive information was blocked I would show you, but it's not as ambitious with the design.
we were here - Okay, so you have to modify the style property of those elements then.
No more tips tonight. I've gotta go to bed soon.
I am really gonna just be searching for the stuff you told me
You can examine those pages, though.
You've got almost a week, you've still got a little time.
lol, not 1 week to work on this
I got 3 more other courses
I find networking and discrete mathematics to be harder than this
so I am trying to do this in 2 days maximum @topaz widget
is that possible @topaz widget ?
With your skill level that would be ambitious @white spruce
Since you know hardly any JavaScript.
just started a little course I saw, about to spend all night doing it
Well, good luck. I'm off to bed by the way, but I'm on here every few days or so, sometimes multiple in a row.
okay man, I'll be back later to ask questions or problems I face
why i always keep getting this
this is my code where i get the html file not the css
i still get the same
i change it
but still the same
ahh i changed my port number and it works
hmmm, the only thing I can think is that your router is someone pointing to your css? im not sure
driver = selenium.webdriver.Chrome(PATH)
driver.get(WEBSITE)
in this the bot opens the chrome brower and goes the the website, but is there any method for bot to go to the website in its own system and not open my browser?
@cunning falcon This library might help https://github.com/mherrmann/selenium-python-helium/blob/master/doc/Cheatsheet.md#headless-browser
Yeah that's how its meant to be used
async def youtube(ctx, *, vid_name):
driver = selenium.webdriver.Chrome("C:\\Program Files (x86)\\chromedriver.exe")
driver.get("https://youtube.com/")
search_bar = driver.find_element_by_id("search")
search_bar.send_keys(vid_name)
search_bar.send_keys(Keys.RETURN)
print(driver.current_url)``` in this i get error as element not interactable
im trying to send keys to yt search bar
It is against youtube ToS, we canβt help you with that
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)
huh
Thatβs the same idea, even if you arenβt using ytdl
Most well established sites have a robots.txt which state whether the site can be automated or not. This looks disallowed to me.
so i cant get information through yt?
Nope
oh
Oh well
my code ruined ;-;
Not sure if what you are looking for is in their API
anyone familiar with heroku and flask?
@proven orchid sure
Ah
hold up
here
didnt work
what i want to know is do i have to mention only the app or the api, cors and app together in the procfile
while using the rest api
ohh hmm
are api and app different?
and what does cors have to do
show ur procfile
@proven orchid
cuz im fetching request from the api i made and cors block it until i allow origin
show procfile
One message removed from a suspended account.
ofc
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Hi, Django is causing me some headaches, any help is appreciated in #π€‘help-banana
Hey good morning! I am trying to pass a Python list to a Jinja template via Flask's render_template and having all sorts of issues. I want to use the list for validation on the client-side, before the submit/post, but it keeps coming across as a literal string of '<Response n bytes [200 OK>'
I've tried jsonify, json.dumps, tosjon, JSON.parse, still having no luck, any tips?
ah don't really have experience with channels tbh
but why are u confused with saving the messages
Hi All,
Django related question.
I am making a call to an API, fetching the data and displaying it on the webpage.
Should I directly display it or fill it in database and display from my model?
What is more optimum way of doing this?
it depends
if you're calling quite frequently
and the data doesnt change, then probably yes
also look for API policies
how to pass through a looped flask variable to JS like:
{% for item in register.account_type %}
<label class="btn btn-secondary active">
{{item(onclick="toggleRadioChecked('item')")}} {{item.label}}
</label>
{% endfor %}
I have tried toggleRadioChecked('{{item}}'), toggleRadioChecked('item) and toggleRadioChecked('item')
Anyone work with the Google Maps API before?
I want to determine if there is a way to get which side of the road Iβm on
if i have an error like this The list can have maximum 100 elements. what code should i return for the page?
@cold socket Im currently working with the Google Maps API but I havent come across anything that would allow you to determine that. Ive only been working with it for a week though so you may want to take a look yourself
I have a Django question, when it comes to simple custom user models is there any downsides to using AbstractUser over AbstractBaseUser? I understand AbstractBaseUser allows you more control but Im wondering if it would still be recommended for a simple user model
@worn basin Thank you I appreciate it!
I think the django docs say that unless you know what you are doing you shouldn't need to mess with AbstractBaseUser @worn basin
lol Im seeing this "The easiest way to construct a compliant custom user model is to inherit from AbstractBaseUser." that's why Im not sure. https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#specifying-a-custom-user-model But thank you
Im more concerned about any longterm issues I may have
Hmm, I see. Thank you for the link!
I want to determine if there is a way to get which side of the road Iβm on
@cold socket Note that GPS (and most location services)mymay not always be accurate enough to determine that, so I wouldn'treallyrely on it even if you do find a way. (Lol, ok, I shall double-check my spelling more).
*may
Hi can someone help me with a Bootstrap 4 issue, this row has all the same size columns and cards, but the image column is never equal height to the others
Is there a way to fix this?
Make margin-bottom
That's inbuilt
and check if image size is affecting the widget
I tried margin-bottom for the card, it just reduces the image in size but the card size stays the same
do you guys use blueprints often
i have an app that I've been working on and it's getting a bit unmanagable
i think i need to look at blueprints
@lethal orbit not entirely true, if the signal is accurate, you can get on average 5m accuracy and that's enough for that task
@glacial night that depends on many factors. First of all, not all streets even are 5 metres wide lol. Second of all, users may not even have precise location turned on. Saying that location services "may not always be accurate enough" is definitely 100% true.
Also, in cities, with buildings and trees, you are even less likely to have 5m accuracy.
Does anyone know if I want to gitignore a directory if I need the relative path or just the folder name?
so its enough in my opinion
Depends. For US suburb? Sure. For the old part of town of any European or North African city (or probably Asian)? Hell nah.
Does anyone know if I want to gitignore a directory if I need the relative path or just the folder name?
@topaz widget I thinkgitquestions are more suited for #tools-and-devops, but I generally use the whole path. If it is something that repeats (e.g. those annoying__pycache__directories, and you want to ignore them all, then you can add**/__pycache__/
by whole path do you mean absolute path or path to the directory from the repo?
(.git folder)
You can also add a .gitignore inside a folder (e.g. /folder/subfolder/.gitignore with a relative path (foo instead of /folder/subfolder/foo)
Sorry, the path relative to the git root.
@lethal orbit lol its not LTE, its gps, the accuracy is the same, or maybe i dont know something
@glacial night they are still radio waves, so they are affected by things like walls and trees.
Means "match in all subfolders"
gotcha, thanks, yeah that's what I meant.
The point is, I don't know where you are from, but an 8 lane-avenue with a mall strip in Florida is wide, and unobstructed enough that you could definitely determine what side of the street you are on.
Go to the gothic quarter in Barcelona, and you have 2 metre-wide streets, with 4-5 story buildings....
Go to a medina in a North African city, and it's probably not wide enough for a car lol
Even in Paris, most roads are much narrower than in NYC.
Well, it is if there are more buildings obstructing the signal.
@lethal orbit Do you use git a lot?
Yup
Everything. Mostly web dev, some networking apps, some GUI, some games....
How often would you say you commit new changes to a repo for a given project?
Data processing apps, too.
Basically every time I make a change that is complete...
Not necessarily major upates....
Okay, the reason I'm asking is because I don't often find reason to use git.
It can be a single function.
Uff.... Finally completed my flutter app with DJango rest framework
Like, I could be using git wrong, but the only reason in my mind currently is if I want to freeze the project in a current state.
which doesn't happen that often.
bro use a different branch
No, the reason to use git is to keep track of changes.
@glacial night That sounds like a case for backups!
@viscid roost Yeah, that's my impression, which is why I'm using it now. I have gotten to a "stopping place" on a project.
then run git reset --hard <hash> that's it
I use it pretty infrequently, but maybe I should be using it more.
why
why what?
My concern is having too many commits that they become essentially meaningless.
I just want major updates to be committed.
Yeah, good point.
and master for major updates
I never directly commit to master branch
I pull the request from the another branch
after checking it carefully
@topaz widget Basically, my (web dev) workflow is like....```
- create a new repo
- git clone repo
- add basic docker-compose / docker files; commit
- initialize django project; clean up settings.py; commit
- add basic front-end; commit
- add a model to django; make migrations; commit
- add a component to my vue front-end; commit
- repeat with new features
And yes, use feature branches.
Wow that is a lot of commits.
Wow that is a lot of commits.
Commits are good.
Is that master branch @lethal orbit ?
Never.... if you are doing it frequently its very confusing
I usually make a branch for each feature.
Then I rebase master on top of that when it's complete.
Then he will have 80 - 90 branches
lol
Though most people don't know what is good for them and merge rather than rebasing.
Authentication feature, like feature, share feature and the list go on and on
I guess I never saw the point of creating a repo until a project was in some kind of 'finished' state.
no you delete feature branch after merge
Then he will have 80 - 90 branches
That's why you work on a feature, merge (or rebase) and delete it π
yep
Gotcha.
u mean git
I don't really use github that much.
so I don't have to go to the website
oh github cli, I didn't use yet, is it good
github is amazing
I have a github account, but I don't see the point of putting code up there.
see mine
I am Ashish Kumar Verma, 14 years old from INDIA, Love to write lines of code that help people, Thank You
Contact 7541866702 / mrpycoder@gmail.com - imdigitalashish
I create a repo on GitLab before I write any code locally.
I have a github account, but I don't see the point of putting code up there.
@topaz widget 1) backups of your code if your computer melts down / is stolen. 2) you can use it for CI/CD.
hmm ok
YEah CI/CD is great
Push code to gitlab, it runs tests, builds my docker containers, and I can click one button to deploy to production.
Honestly I would get rid of your headshot, too.
I think an avatar is a safer option.
When did you start coding @viscid roost ?
right π€¨
14 is very young to be as deep into it as you are.
mhm even im learning the ropes with CI/CD
Is it easy to get into docker?
damn that YouTube channel >-<
But not that bad.
Docker seems desirable to employers from what I've seen.
I started coding when I was in 5th std
two githubs?
Docker seems desirable to employers from what I've seen.
@topaz widget it is. So isgitxD
Yeah
So you started coding when you were 9 or 10??? @viscid roost
which one is for real ones?
imdigtalashish
username
dspashish ashish is just for learning
actually there are 200 repos in dspashish
all are private
only some are public
Anyone here used django-notifications? I am trying to figure out what the fields on the model are called
New to CI/CD stuff and saw you guys talking about it here, do you guys have any recommended resources? (CI/CD for Django)
What would you recommend for a rather small project?
Saw someone say there's a learning curve to it lmao
This is meant to be a small school project
I mean docker would allow to install your project to any system p fast, just that you'll have to install Docker on it first
Anyone here used django-notifications? I am trying to figure out what the fields on the model are called
@devout coral https://github.com/django-notifications/django-notifications/blob/master/notifications/base/models.py#L140
Alright thanks! I'll look into it
π
Django is very good
now async funationalities is superb
I have done removing my creds
nice
but it also
oh btw neat youtube channel
product a JSON
π
ya
offtopic channel
okay
!ot @viscid roost
Off-topic channels
There are three off-topic channels:
β’ #ot0-fear-of-python
β’ #ot1-this-regex-is-impossible
β’ #ot2-the-original-pubsta
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
When I get tired or hungry I cannot think lmao
import antigravity
Hello, I just finished implementing django-notifications project into my project and set up emailing for it. I just made a signal that anytime a new notification is created it sends the email using smtplib. The only issue is it will be sending emails to about 12-20 people so once I trigger the notification my page just continues to load until all those emails were sent. What would be a good approach to have these emails be sent in the background?
Celery
Takes a bit to set up, but it's basically the de facto background task runner for Django.
Lol so set up celery
Second question, if I have a variable with the string of a field name. What would be the best approach to get that field value.
for example i have field_name = name
how would I get model.name
ye
getattr(model, name)
string for a field name ah
@lethal orbit Where is that function?
Thanks, worked like a charm
How should templates be organized in django directories? cant seem to extend my template (im really new)
Any flask users in here?
Having trouble with my admin page.
Trying to secure it, so only the username "admin" gets access to the admin panel. But it doesnt work.
searched up a ton of tutorials / documents, but when i Do the stuff they tell me to, it doesnt work. the username "admin" is just a regular user in my coding :/
When you guys work with Django do you guys use React much?
hows ur authenticatin setup then
class AdminView(ModelView):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.static_folder = 'static'
def is_accessible(self):
return session.get('User') == 'Admin'
def inaccessible_callback(self, name, **kwargs):
if not self.is_accessible():
return redirect(url_for('login', next=request.url))
flask doesnt have stuff like this by default. u mustve setup some system for auth
is that some sort of external lib
admin = Admin(app, name='Dashboard', index_view=AdminView(User, db.session, url='/admin', endpoint='admin'))
admin.add_view(AdminView(User, db.session))
admin.add_view(AdminView(Transactions, db.session))
this is my admin.py(first one) and second is my init
When you guys work with Django do you guys use React much?
@native tide I think react is horrible garbage soup, but I use it with Vue a lot.
I have used DRF for REST, but mostly use Ariadne for GraphQL nowadays.
Should be fairly similar, tbh.
I've just been learning Django and React recently but I don't necessarily think they're the best fit (maybe?) so I was looking around for some other frameworks
To use with React
Django is great. I'd just recommend splitting it into two.
@tawdry magnet yes, found several tutorials / documentation saying this is the way you set up auth on the admin page
Yeah I tried to use react w/ templates and that was horrible
So I'm looking into Django and APIs
but I don't really understand it.
For example, how to sort out the routes in Django and linking that with React
flask is desighned to me minimal. so everything can be done yourself. thats one of the things i dont like about django
random external libs that do entire things like authentication just fudge it up and get in the way
For example, how to sort out the routes in Django and linking that with React
Best tip I can give you (for a new website) - don't bother with routes, and go with GraphQL instead of REST.
Yes I've used Flask before I liked it but there's not as many jobs in the UK for Flask compared to Django so I chose to hop onto the Django boat
i was talking to revooo
Oh lmao
But really, it should be similar in both cases.
well, notsure how to do it without these libs tho :/
How would GraphQL go about with routing though? @lethal orbit or DRF for that matter
Just route either /api/... (e.g. domain/api/foo) or /graphql to Django
GraphQL has a single endpoint, then you define a schema
i have no idea im talking in general
ohh
Ok I really need to do that but I keep procrastinating lmao
Do you have a website you are working on?
Well, I tried to do it with Django + React in a template. That didn't work, that was today. So I'm starting a new project
So not at the moment
kk
Well, you have 2 basic options, rest or graphql. If you go with rest, you need to define your models, your apps, and your endpoints.
So you can have /api/blog/posts to get all blog posts, for example.
/api/links, /api/projects, etc.
If you go with graphql, all requests go to the same endpoint /graphql ... and you need to send the appropriate queries
What is nice with graphql is you can nest queries.
query {
blogPosts {
title
date
author {
name
}
content
}
}```
And define exactly what you want to get
So you don't have underfetching / overfetching of data
As to how it goes with routing.... you need to define a schema (e.g. blogPosts query), and define resolvers.
My recommendation would be to look at the ariadne website - it's great with Django - and play around with it. If you have specific questions, feel free to ping me tomorrow.... i gotta go to bed.
By which I mean I will probably spend hours online on the laptop anyways lol
Ok, thanks so much! @lethal orbit I'm gonna read around, definitely will learn DRF for future plans at least. Night night π
I'll save your message for a cheeky read later π
Unless you know you want to work with DRF, try Ariadne first π
It's good to know both - a lot of REST projects already out there....
But if you start something new, GraphQL has some many benefits.
π
π
@marble carbon are you laughing at me preaching the gospel ofariadneagain? π
yep
π
everytime someone mentions API, i have pretty much seen u advocating GraphQL to them everytime, kinda like a ritual at this point
hey
i have made an only html and css website
can anyone review it for me pls ..... i am a complete beginner !!
sure, post
everytime someone mentions API, i have pretty much seen u advocating GraphQL to them everytime, kinda like a ritual at this point
Having worked with both, it is a lot nicer, tbh :p
@marble carbon
that is a perfect screenshot. 5/7
it has the same color hovers on buttons and navbar links
in case you only wanted feedback in terms of design, then yes looking good
yess i wanted to knw that ! thanks tho π
@winter spindle Is that your website?
yess only a single page html and css
can you share link?
no no i havent hosted it or anything
That looks nice
no no i havent made all tht stuff
Is this a bootstrap template?
You made from scratch?
yess
Nice
i suppose you too have started web dev ?
Yes, I have a website. You can check it out. https://perasperadesign.com/
ohh yea sure
you can try a different font maybe, the one u have not the best in terms of pleasing to the eyes
I made that one months ago
there's Lato, which u could try
Which font? I have like 3 or 4.
hmm lol
well then
you got another tip incoming
use a single font throughout, to keep design uniform
@marble carbon I disagree on the last point.
why?
https://fonts.googleapis.com/css?family=Muli|Varela|Red+Hat+Display|Varela+Round|Raleway|Quicksand&display=swap
Those are the fonts I use
Time to learn how to use celery.
Maybe. The thing is: using different fonts for different features can distinguish them from one another.
And it can establish hierarchy.
hmm well there are more ways to distinguish stuff, color, font weight, size and all
But yes, if using different fonts, they must be selected carefully.
There's a website that suggests pair of fonts that go well together
lemme see if I can find it
like title text and paragraph text is almost always different for example.
okay can't find the exact website but https://fontpair.co looks similar
Hm, okay, I'll check it out.
okay yes nvm found the other one too
Fontjoy helps designers choose the best font combinations. Mix and match different fonts for the perfect pairing.
another thing, when the lightbox is open, I can still scroll x)
I know you can still scroll. I decided it didn't matter.
okay there's not much I can tell you in terms of design that would make sense in the form of text
though there's this youtube I follow that explains UI/UX stuff
https://coursetro.com New videos weekly from Monday to Thursday @ 10:30 AM ET! Hi, I'm Gary. I've created close to 100 courses from graphic design to advance...
you can checkout his videos about portfolios on this link
Okay, I'll see what he has to say.
@marble carbon Wanna give me some feedback on what I have been working on?
hm?
sure
welcome to today's video where i'll be giving feedbacks on the projects you guys submitted to me last week
π
ignore the messed up certificate
username: mickey.mouse
password: Testing321
All the data is dummy data
ye, dont think u can add certificates to IPs without errors
Yeah I had to get a different IP for the server and have not moved the domain to it.
sure
just capitalize the first letter of words in the navbar
go for it
@devout coral do you want feedback in terms of design?
Okay, good feedback. I grappled with that one. Decided to go for the apple lowercase aesthetic.
@topaz widget nvm π
I also did all uppercase but it just looked too intense.
@marble carbon Sure, just feedback in general really
hmm, using bootstrap?
Can you tell lol
@topaz widget also you can do a better hover on those navbar links instead of just an underline
not really, if i am being honest navbar is bit messed i think
yeah
What do you think, like change the color, too? @winter spindle
yeah u can
What about the navbar do you guys not like?
@marble carbon Alright, what is broken about it ? I cannot really tell
but the current one also feels good
Oh also, it is not responsive. At all
like the styling is not done properly ig
What about the navbar do you guys not like?
@topaz widget i was talking about snowball's website
It is most definitely responsive if we're talking about my website.
yours was fine
Oh ok
you can just capitalize the first letters
lol
Okay, well there's a lot I could do on hover, what were you thinking?
and you can ignore my suggestions cuz i am just 10 to 15 days into web dev π
@devout coral is it fine if I send screenshots for reference to my comment?
Yes
You being new to web dev doesn't mean you have poor design sense.
I like feedback, good or bad.
Doesn't necessarily mean you have good design sense either though.
you know that hover that underlines the bottom part
But I'm happy to take your feedback.
ok this section needs little rework
simultaneously 2 discussions on 2 websites π
@marble carbon Yeah.... I just was not sure how. I had something different before but it was horrific.
so i checked, ur using bootstrap
Go ahead and click on assign attendance point. So it can populate and you can see what I am doing.
no no you guys carry on !
okay
Just ping who you're addressing and it will be all clear.
okk
@marble carbon Not saying it does not need some work I am just not sure what to do....
@winter spindle What would you like to see those titles on the nav do on hover?
yea
@devout coral so instead of reinventing the card component yourself, how about u use the bootstrap component for card instead : https://getbootstrap.com/docs/4.0/components/card/
Bro....
@marble carbon Not saying it does not need some work I am just not sure what to do....
@devout coralYou do not have access to this page
I did not even know that existed lmao
@marble carbon Let me fix that
@marble carbon Try now
haha now i have to fill it
Also, are you getting a server error when accessing "Employee Information"
Yeah just put random stuff.
it's fine i can review other stuff
so
this section, you probably need it on every tab, let's say when someone clicks on assign attendance point, you do not want it to disappear
there's two ways to do this
upto you
either use a vertical nav
or a subnav bar
dont copy this, since this isnt bootstrap
Yeah, I think the vertical nav might be good.
