Kar
Kar

Reputation: 6345

Creating a new directory in Heroku

I'm very new to Heroku and I've just pushed my Django app into Heroku. Does anyone know how to create a 'log' directory under '/app'? Is /app the top directory of my app?

Thanks

Upvotes: 5

Views: 7726

Answers (2)

Will Schoenberger
Will Schoenberger

Reputation: 898

Is the log directory in your .gitignore file? If /log is an unversioned directory then K Z's answer should help regarding Heroku; unless something else is going on with Heroku and the log directory in your repo.

Regarding committing an empty directory

You cannot commit empty directories to git, but you can add a .gitignore file in a directory that ignores all files inside except itself. This would be as close as you can get to versioning an empty directory as I'm sure you don't want to version control your log files.

Make sure the log directory is not in your main .gitignore file. Then in your log directory create a new .gitignore that contains the following:

# Ignore everything in this directory
*
# Except this file
!.gitignore

You can check out Jamie Flournoy's answer here How can I add an empty directory to a Git repository?

Upvotes: 4

K Z
K Z

Reputation: 30453

To create a new directory you can simply create one in your local directory (i.e., cd app; mkdir log then commit & push to Heroku.

Whether /app is the top directory or not depends on your directory structure, normally it is the name of the app on Heroku that's set as the top directory. Though, if you are inside your git repository that's used for your Heroku app, you can find the root directory by:

git rev-parse --show-toplevel

which is a git command that tells you the top level directory of this git directory.

Upvotes: 0

Related Questions