foreman start error, Procfile does not exist - python

Directory Contents
sid#midnight:~/kuma$ ls
admin_dashboard.py requirements
celery.py scripts
configs settings_local.py
contribute.json settings.py
CONTRIBUTING.md settings_test.py
docs settings_travis.py
etc templates
kuma tests
kumascript tox.ini
kumascript_settings_local.json urls.py
kumascript_settings_local.json-dist vagrantconfig_local.yaml
LICENSE vagrantconfig_local.yaml-dist
manage.py vagrantconfig.yaml
media Vagrantfile
migrations vendor
Procfile webroot
puppet wsgi
README.rst
Then I did vagrant ssh
Which succeeded with Last Login:...
Then I did foreman start, which gave
vagrant#developer-local:~$ foreman start
ERROR: Procfile does not exist.
What am I doing wrong?? I'm a beginner to this stuff, please go easy on me. Thank you.

Related

Heroku looking for Procfile in wrong directory

I'm trying to work with Django on Heroku and I'm following this tutorial with its Django template https://devcenter.heroku.com/articles/django-app-configuration
https://devcenter.heroku.com/articles/deploying-python
But when i run 'heroku local web' it always look in the wrong directory. I've tried to move the project
(env) D:\Study\Workbench\heroku-testing\testing\env\codeShareApp>heroku local web
[WARN] No ENV file found
[WARN] ENOENT: no such file or directory, open 'C:\Users\William\Procfile'
[FAIL] No Procfile and no package.json file found in Current Directory - See
run_foreman.js --help
The project directory is as follows
env/
codeShareApp/
.idea/
codeShareApp/
.env
manage.py
Procfile
requirements.txt
runtime
include/
Lib/
Scripts/
tcl/
EDIT:
I tried to make a new project with directory like below, but still got the same error
codeShareApp/
codeShareApp/
env/
.env
manage.py
Procfile
requirements.txt
runtime
I encounter this problem also in a project; I solved this by Making sure that the Procfile is using the correct syntax, and that there are no extra tabs or newlines in the file.
especially whitespcae.
I dont know why, but I tried it on another machine and it works just fine. It seems that it has something to do with heroku cli 6.13 because the error only occurs after it updates from version 5.12 to 6.12
The documentation says:
The file must be placed in the root directory of your application. It will not function if placed in a subdirectory.
Try to do this and it should work. See the docs for more information.

Changing the settings file when using django and gunicorn together

I've deployed my Django project using this tutorial and it works fine.
Now I want to split the settings file and have multiple settings in development and production environments. I created a settings directory and added these files into the directory:
my_project/
manage.py
my_project/
__init__.py
urls.py
wsgi.py
settings/
__init__.py
base.py
dev.py
prod.py
The base.py is same as former settings.py (that was working fine). I imported base.py and added DEBAG=False and ALLOWED_HOSTS to prod.py.
How can I tell the gunicorn to run my application with prod settings?
The gunicorn.service file, based on the tutorial is like this:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myproject
ExecStart=/home/sammy/myproject/myprojectenv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/sammy/myproject/myproject.sock myproject.wsgi:application
[Install]
WantedBy=multi-user.target
You can set DJANGO_SETTINGS_MODULE environment variable for this, as mentioned here.
So you can try to add something like:
Environment="DJANGO_SETTINGS_MODULE=my_project.settings.prod"
to [Service] section.
The problem was the settings.pyc file in the project directory. Removing that file, fixed the problem.

'No default language could be detected for this app' with Flask

I have a Flask app which runs fine locally with Heroku. However when I try git push heroku master I get the error No default language could be detected for this app.
Setting the buildpack manually with heroku buildpacks:set heroku/python and then trying to push also gives an error: Failed to detect app matching https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz buildpack.
Is this error because I have file types other than Python in my project? The project structure is below, and the data folder contains several different file types.
app/
data/
model/
utils/
static/
css/
templates/
Procfile
README.md
requirements.txt
runtime.txt
run.py
If so, what's the recommended course of action here?
For some reason when I switched to master branch I was able to push successfully.

.gitignore not ignoring the files Django

So I'm testing out Heroku with a dummy app called hellodjango, and pushing everything to git.
Added my .gitignore file (tell me if I'm wrong, I created a text document called django.gitignore, and the contents are 1 line, no spaces, venv*.log*.pot*.pyclocal_settings.py.
Not sure what I'm doing wrong, but here is my directory
hellodjango/
django.gitignore
manage.py
requirements.txt
hellodjango/
__init__.py
__init__.pyc
settings.py
settings.pyc
urls.py
urls.pyc
wsgi.py
wsgi.pyc
venv/
Include/
Lib/
Scripts/
So I don't want to stage any .pyc files or the venv folder.
In my command line, I enter
git init
Initialized empty Git repository in /Users/Chris/hellodjango/.git/
>git add .
>git status
When I enter git status, all of the files in venv and .pyc are staged. Why is .gitignore not working?
The gitignore file needs to be named only .gitignore without a django in front of the dot.
You can find more information about ignoring files and possible patterns supported in the ProGit book on the official website: ProGit Chapter 2-2.

Pinax Structure

I have just installed the Pinax but i'm very confused now.
in my structre
i have two directories
mysite and mysite-env
I dont why i have two directories. I just followed the installitation directions
in mysite,
<project-root>
apps/
__init__.py
deploy/
__init__.py
fcgi.py
wsgi.py
fixtures/
initial_data.json
locale/
...
requirements/
base.txt
project.txt
sitemedia/static // I move static file from mysite-env to here
...
templates/
_footer.html
homepage.html
site_base.html
__init__.py
manage.py
settings.py
urls.py
However,
default index page is in mysite-env/lib/python2.6/site-packages/pinax_theme_bootstrap/templates/banner_base.html
Should i manage my site from mysite ?
Pinax uses virtualenv to prevent messing up your local python libs by your project dependency.
So, launch the site with $ source mysite-env/bin/activate it will be fine. If you really hate mysite-env, just skip the virtualenv part.

Categories