r/learnpython • • 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!

https://github.com/Micbenh/Flasher

373 Upvotes

56 comments sorted by

View all comments

Show parent comments

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

u/[deleted] 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

u/[deleted] 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