Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create gitignore for flask application

Tags:

git

flask

What the files I need add to .gitignore in Flask application?
https://www.gitignore.io/ - I'm usually here to look at examples.
But now I found no examples.
Why? Is it a feature of Flask?
Django has a clear structure in the application, but Flask not have, am I right?

like image 505
Serhii Avatar asked Feb 27 '18 10:02

Serhii


People also ask

What can I Gitignore in flask app?

You can use gitignore.io, which selects the files to ignore based on the technologies you are using in your project. There are a few of them only for flask. Save this answer.

How do I ignore a python file in Git?

Git allows you to ignore such files by adding them to the . gitignore file.

Should Pycache be in Gitignore?

__pycache__ is among the directories that shouldn't be pushed to remote repositories. Therefore, all you need to do is specify the directory in . gitignore file.


2 Answers

Use Python.gitignore. Flask is a Python project.

like image 163
phd Avatar answered Oct 18 '22 15:10

phd


Initially, I'd say you will want to include the /__pycache__/ folders in your .gitignore file.

But anything else you may wish to have ignored is incredibly project dependant. It depends on what your Flask app is doing.

You need to ask yourself what exactly your project is doing. Is it storing lists of user details (such as usernames / passwords) somewhere? Then you'll want to keep those details out of git. Are you accessing a database with a user and password and showing how to access confidential information in your database tables? Then you should be making sure none of those end up in a public git repository where just anyone can waltz on in and see how everything you've built has been put together and where they need to go to access all sensitive data stored by your app.

Depending on your goal with your app, maybe you could consider using a private repository?

Without further information on your Flask application, I can't say much more. But this is my response to the matter either way.

Definitely ignore the /__pycache__/ folders generated by Python. After that? It's entirely down to the requirements of your app.

like image 30
AJC24 Avatar answered Oct 18 '22 13:10

AJC24