5

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

Kar
  • 6,063
  • 7
  • 53
  • 82

2 Answers2

4

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?

Community
  • 1
  • 1
0

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.

K Z
  • 29,661
  • 8
  • 73
  • 78
  • Thanks. But commit gives me # On branch master nothing to commit (working directory clean) and push doesn't seem to give anything new. How do I make sure the directory I want to add isn't already pushed? – Kar Oct 28 '12 at 23:28
  • @Kate did you forget to `git add log`? You need to add the newly created directory in order to have git track it and hence, commit it. – K Z Oct 29 '12 at 00:47
  • I've done that. That doesn't give any output. How do I make sure it's not already committed? The thing is, the log directory was already in the current directory when I made the first commit and push, but somehow the heroku log seems to imply that the log directory doesn't exist. – Kar Oct 29 '12 at 10:55
  • @Kate does `git log --all -- PATH_TO_LOG_DIRECTORY` give you any results? what does `heroku log` return? – K Z Oct 29 '12 at 11:03
  • `git log --all -- log` gives me the two commits I've done. `git log` gives the same output though. `heroku logs` gives me error messages saying it crashed. It's seems to be caused by the missing `log` directory. It's expected to crash without the log directory. – Kar Oct 29 '12 at 12:21