r/learnpython • u/Santorox2 • May 28 '20
Just finished my first official project!
Hi :)
I have been learning python programming for the last two months +- but i was always scared to start a project and fail in the middle.
i have done a couple of scripts that to little stuff but this is the first time that i tried to build an official project that is not following a tutorial and with git, github, python structure and all of those stuff.
i call it..... Flasher!!
it is a simple Flask web with a button where every time the user presses it it links him to a random flash game from the past.
it is not really complex, I will link here to the github page but i will also write here that my objective was to take a bunch of little topics I have learned in the last month-month and half, configure them to work together and make them do something lol.
obviously there is a *91025915 better way to build what I built but I am still extremely proud of it because in the end I was able to think of something and build it from scratch from start to end, something I would not imagine I would be able to do around a month ago :)
i want to also thank the people of the python and learnpython subreddit that have helped and inspired me to program :)
now i will shut up and link to my project!
20
u/fluffers_the_unicorn May 28 '20
Congratulations! Don't sell your effort short, flex as hard as you can because man you deserve to. I'm very proud of you because you've inspired me to keep on improving myself.
Thanks for making an effort. It makes me believe that I can make one too.
4
u/Santorox2 May 28 '20
thank you very much!!! :) your comment also helps me get motivated and improve my skills!
3
u/iggy555 May 28 '20
Wow you did all that after only 2 months? Congrats!
6
u/Santorox2 May 28 '20
thanks !! actually in the last year or so I would start learning for a couple of days, get stuck, angry and quit but in the last two months I actually promised to myself that I will try to learn and not quit even if I get stuck for a week (which kinda happened In this project lol) so basically I only count the last two months because only in this time I have actually learned seriously and did not quit after a couple of days
1
2
u/diablowhite4golf May 29 '20
Nice!
The only thing Id recommend adding from a brief look is a .gitignore file (which you can autogenerate in GitHub). Noticed a lot of cache files and library files that would be installed from requirements.txt.
If you want to add it,
At the top level directory in GitHub, click add new file. Type in .gitignore for the filename. Select python. Then if you pull it down, it will give you some notification that you have ignored files present in your remote repo and if you want to remove them.
1
1
May 29 '20
Is it best practice to use a .gitignore file?
1
u/diablowhite4golf May 29 '20
If you're using git, yes. Libraries (flask, numpy, etc.) Shouldn't be included in your code when you push it up in git, reducing the size of your pushed code and makes requirements.txt/setup.py relevant
It prevents cache files, files in venv (another good thing to look into), and libraries from being pushed up with the actual code you wrote. You can also add other files and directories to it like a .env (environment) file that may contain sensitive information.
1
May 29 '20
Could you give an example of what it should look like then? I have not encountered this in a tutorial and I always try my best to do best practices. Thank you for the info!
2
u/diablowhite4golf May 29 '20
What it looks like depends on the language you're using, sometimes the IDE as well (like visual studio).
You can have one automatically generated by github. If you go to one of your repositories and click Add New File and call it .gitignore. GitHub will prompt you for a template choice, choose python and it will generate a .gitignore off of that.
1
May 29 '20
Should this file be in your root directory of the project? Was able to add it to my project on github. Will github parse through after and remove all the bloat now that I added the file or do i need to do a new pullpush from my computer to update the repo.
1
u/diablowhite4golf May 29 '20
Yep, right in the root directory. It won't automatically remove excess files. I suggest you pull the branch with .gitignore, create a new branch off it and when you go to push that branch o believe it will give you a notification in the terminal that you're tracking untracked files
1
u/StringOfRandomInput May 28 '20
Thats amazing, that you did that. I have one criticism tho, try to use variablenames that are understandable and represent the variable. So maybe replace the variable a in app.py with gamefile or something like this. I have to be honest, I also have that problem, but I am trying to get rid of this bad habbit.
1
u/Santorox2 May 28 '20
thank you so much, and thanks for the tip! it really sounds like it will make the repo look better :)
1
May 28 '20
you can deploy your flask app on the Google App Engine quite easily (and cheaply / for free) , if you wanted to!
1
u/Santorox2 May 28 '20
ahhh I actually started thinking about deployment but I haven't learned that part yet lol I guess this is! he next step :)
1
u/JerseyFlashBoys May 29 '20
Flasher? I barely know her!
1
u/Santorox2 May 29 '20
lol I thought people would think of it like that but I had to do this for the meme
1
u/stnivek May 29 '20
Congrats on your first project! This is inspiring, hopefully I'll get there soon too. What are your learning resources, if you don't mind me asking? And how did you get started? I started late March but I'm a very slow learner. I started first with Automate, then switched to Crash Course which is much easier for me to digest. I do enjoy coding very much and coming up with simple programs and scripts is always a blast!
1
u/Santorox2 May 29 '20
thank you so much :) I actually havent finished automate the boring stuff but I read chapters that sounded interesting to me and have watched a python path in Plural insight. I have oficially began in the begining of April :)
1
May 29 '20
not the same guy but here is the tut that i followed for my flask project that I have been working on.
https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
1
u/pranav15197 May 29 '20
Great job! I remember doing a similar project which showed the user a random youtube video.
BTW, I just started a youtube channel and one of the things I was planning to do was to review other people's projects and offer suggestions about what could be done better. Would you mind if I used your project for such a video?
1
u/Santorox2 May 29 '20
of course!! can you also link me your channel? :)
1
u/pranav15197 May 29 '20
it's brand new, I just have one video up so far of a live stream I did few days ago making a Django app
https://www.youtube.com/channel/UCwflbqS5hrhxlcdpg6TVolw?view_as=subscriber
But I am hoping to post at least twice a week.
1
1
May 29 '20
As someone working on a large flask project atm. Could you explain to me how you set up a requirements file. Also how did you settle on those versions? Cool first project man!
1
u/Santorox2 May 29 '20
hi :) in order to set up a requirements.txt you need to enter into your virtual environment in case you have one and in cmd type: pip freeze > requirements.txt
pip freeze shows all your packages and their versions and the arrow tells your computer to save it inside a txt file named requirements.
about the versions, I did do anything special, I believe they all are the latest versions because I installed them into a venv that I built for that project :)
1
May 29 '20
Nice I knew about requirements.txt from guides that used a boiler plate, but never really looked to much into it. Will have to play with this a lot more
1
u/Santorox2 May 29 '20
awesome :)
1
1
u/PussPussMcSquishy May 29 '20
I've just started several months back and have sort of an embarrassing question...
But where can I find when and how to use all the supporting files like setup.py, requirements.txt, __init__.py, pycache, or separate folders for separate items?
Is there some sort of standard convention to follow when it comes to splitting up my code files, what to call folders, what to call certain files? Like, I have several working programs at this point, but I don't think I'm following (or even aware of) how my git repository should be constructed.
1
u/Santorox2 May 29 '20
lol I'll tell you a secret but I also don't really know in the beginning, I just understood that it is the norm. basically you need to include them in every project you want to publish
1
u/ramyadavj May 29 '20
Congratulations!!. You post is inspiring to me . Soon I hope I will start one on my own .
1
1
u/Silfalion May 29 '20
Way to go, man, keep on building what you love!
Edit:consider maybe hosting it with gatsby or something similar.
1
u/e-rekt-ion May 29 '20
Yesss you have a great road ahead of you with more and more satisfying projects
1
u/lordv0ldemort May 29 '20
Great job! Seeing a project all the way though is always amazing! I’m about to be working on a Click CLI app as my first true Python project and I’m excited to take it slower and really get an understanding of Click, SQLite, and Python in general.
Bask in your glory!
0
u/OnlySeesLastSentence May 29 '20
Just a heads up - I might be misreading the code, but I think you forgot to make a seed for your random.
Check out "python random seed time" to get different results everytime.
1
u/Santorox2 May 29 '20
sounds interesting, I will read about the random seed but the button still generates different results without it thanks for the tip!! :)
1
u/OnlySeesLastSentence May 29 '20
Huh, that's weird. So you mean when you exit the program and return it, it's not opening the same website the first time every time?
1
u/Santorox2 May 29 '20
nope :) you can even clone it and see for yourself if you want to
1
u/OnlySeesLastSentence May 29 '20
Oh nice. Looks like I need to study how random works because I learned it incorrectly.
Supposedly it's impossible for that to happen without a seed lol
1
u/donkeybowser May 29 '20
f something and build it from scratch from start to end, something I would not imagine I would be able to do around a month ago :)i want to also thank the people of the python and learnpython subreddit that have helped and inspired me to program :)now i will shut up and link to my project!https://github.com/Micbenh/Flasher28 commentsGive Awardsharesavehidereport97% UpvotedComment as donkeybowser
.public-DraftStyleDefault-block[data-offset-key="34f3a1_initial-0-0"]::after {
bottom: 0;
color: var(--newCommunityTheme-actionIcon);
content: 'What are your thoughts?';
cursor: text;
left: 0;
position: absolute;
top: 0;
}
commentBoldItalicsLinkStrikethroughInline CodeSuperscriptSpoilerHeadingBulleted ListNumbered ListQuote BlockCode BlockTableSwitch to markdownMarkdown modeSort bybest level 1Patrick347097
43 points · 7 hours agoCongratulations, That's amazing :)! I started to learn how to program a couple of days ago and it's making me a little demotivating knowing that there's so much to learn. Seeing this post really put me back in the mood to continue so thank you :)ReplyGive AwardshareReportSavelevel 230minute_un
20 points · 7 hours agoIf you're someone that interacts with data for work, you can have insanely useful code in a manner of weeks. It won't be pretty enough to package into a git and publish with your handle attached but it will be more than enough to save you hours and days of your life on nonsense. Don't be disheartened.ReplyGive AwardshareReportSavelevel 2Muda42
6 points · 6 hours agoThe best way to learn is to to do it along the way. Instead of learning everything first just get comfortable with the basics, create a small project and slowly it's gonna become more complex and you're gonna learn new stuff (at least this is how I am doing it)ReplyGive AwardshareReportSavelevel 3Santorox2
Original Poster5 points · 5 hours agoyes I understand that but thing is that I was always scared that someone more experienced would 'attack' what I built. so even before I thought about a project I made myself quit by thinking what other people would say/think about me and my skillsReplyGive AwardshareReportSavelevel 4Gabernasher
2 points · 1 hour agoWe have a saying on the internet. Fuck the haters. People are always gonna hate, they may or may not have constructive criticism, so take that for what it is, but don't absorb the malice, it won't help.ReplyGive AwardshareReportSavelevel 2Santorox2
Original Poster2 points · 5 hours agoAwesome! lol it goes both ways, you being inspired by what I posted makes my inspired to continue lol, thank you too!ReplyGive AwardshareReportSavelevel 1fluffers_the_unicorn
13 points · 6 hours agoCongratulations! Don't sell your effort short, flex as hard as you can because man you deserve to. I'm very proud of you because you've inspired me to keep on improving myself.Thanks for making an effort. It makes me believe that I can make one too.ReplyGive AwardshareReportSavelevel 2Santorox2
Original Poster2 points · 5 hours agothank you very much!!! :) your comment also helps me get motivated and improve my skills!ReplyGive AwardshareReportSavelevel 130minute_un
3 points · 7 hours agoCongratulations!ReplyGive AwardshareReportSavelevel 2Santorox2
Original Poster1 point · 5 hours agothanks !!!!ReplyGive AwardshareReportSavelevel 1iggy555
2 points · 5 hours agoWow you did all that after only 2 months? Congrats!ReplyGive AwardshareReportSavelevel 2Santorox2
Original Poster5 points · 4 hours agothanks !! actually in the last year or so I would start learning for a couple of days, get stuck, angry and quit but in the last two months I actually promised to myself that I will try to learn and not quit even if I get stuck for a week (which kinda happened In this project lol) so basically I only count the last two months because only in this time I have actually learned seriously and did not quit after a couple of daysReplyGive AwardshareReportSavelevel 3iggy555
1 point · 3 hours agoNice job mateReplyGive AwardshareReportSavelevel 1StringOfRandomInput
1 point · 7 hours agoThats amazing, that you did that. I have one criticism tho, try to use variablenames that are understandable and represent the variable. So maybe replace the variable a in app.py with gamefile or something like this. I have to be honest, I also have that problem, but I am trying to get rid of this bad habbit.ReplyGive AwardshareReportSavelevel 2Santorox2
Original Poster1 point · 5 hours agothank you so much, and thanks for the tip! it really sounds like it will make the repo look better :)ReplyGive AwardshareReportSavelevel 133madness
1 point · 5 hours agoyou can deploy your flask app on the Google App Engine quite easily (and cheaply / for free) , if you wanted to!ReplyGive AwardshareReportSavelevel 2Santorox2
Original Poster1 point · 4 hours agoahhh I actually started thinking about deployment but I haven't learned that part yet lol I guess this is! he next step :)ReplyGive AwardshareReportSavelevel 1ramyadavj
1 point · 4 hours agoCongratulations!!. You post is inspiring to me . Soon I hope I will start one on my own .ReplyGive AwardshareReportSavelevel 1susakki
1 point · 3 hours agoAround how many hours did you spend a day?ReplyGive AwardshareReportSavelevel 1Silfalion
1 point · 3 hours agoWay to go, man, keep on building what you love!Edit:consider maybe hosting it with gatsby or something similar.ReplyGive AwardshareReportSavelevel 1e-rekt-ion
1 point · 24 minutes agoYesss you have a great road ahead of you with more and more satisfying projectsReplyGive AwardshareReportSavelevel 1JerseyFlashBoys
1 point · 16 minutes agoFlasher? I barely know her!ReplyGive AwardshareReportSavelevel 1OnlySeesLastSentence
0 points · 4 hours agoJust a heads up - I might be misreading the code, but I think you forgot to make a seed for your random.Check out "python random seed time" to get different results everytime.ReplyGive AwardshareReportSavelevel 2RippyTheGator
2 points · 1 hour agoCorrect me if I am wrong, but if you do not make a seed doesn't random automatically use system time as the seed ?ReplyGive AwardshareReportSavelevel 2Santorox2
Original Poster1 point · 4 hours agosounds interesting, I will read about the random seed but the button still generates different results without it thanks for the tip!! :)ReplyGive AwardshareReportSavelevel 3OnlySeesLastSentence
1 point · 4 hours agoHuh, that's weird. So you mean when you exit the program and return it, it's not opening the same website the first time every time?ReplyGive AwardshareReportSavelevel 4Santorox2
Original Poster1 point · 4 hours agonope :) you can even clone it and see for yourself if you want toReplyGive AwardshareReportSavelevel 5OnlySeesLastSentence
1 point · 3 hours agoOh nice. Looks like I need to study how random works because I learned it incorrectly.Supposedly it's impossible for that to happen without a seed lolReplyGive AwardshareReportSaver/learnpythonSubreddit for posting questions and asking for general advice about your python code. 366kMembers2.5kOnlineCreated Oct 2, 2009
I think a seed is used when you want to be able to replicate results. In OP's case, python auto-generates a seed which can do "random" actions
2
u/RippyTheGator May 29 '20
Correct me if I am wrong, but if you do not make a seed doesn't random automatically use system time as the seed ?
0
1
73
u/Patrick347097 May 28 '20
Congratulations, That's amazing :)! I started to learn how to program a couple of days ago and it's making me a little demotivating knowing that there's so much to learn. Seeing this post really put me back in the mood to continue so thank you :)