How can I change the Procfile to run the Gunicorn process in a non-standard folder on Heroku?
change
web: gunicorn --pythonpath application.george_paintings george_paintings.wsgi
toweb: gunicorn --pythonpath application.george_paintings.george_paintings.wsgi
You had a blank space in between the folder names. Deploying a Django application to Heroku - No module named 'django_project.wsgi
With Procfile at the root directory (that is, one level above manage.py), I've changed its content to the following:
web: gunicorn --pythonpath django_project django_project.wsgi --log-file -
As per this answer.Here's my project structure now, just in case it wasn't clear where Procfile is located:
Now everything works as it should.
I'm marking this question as solved.
heroku procfile problem : ModuleNotFoundError: No module named 'myApp.wsgi'
djangoherokuapp
|-- tabele/
| |--- __init_-.py
| |--- settings.py
| |--- urls.py
| |--- wsgi.py
|----- manage.py
|------Procfile ⬅⬅⬅
|------requirements.txt
|----- app/
| |--- admin.py
| |--- apps.py
| |--- __init__.py
| |--- models.py
| |--- tests.py
| |--- views.py
Add a Procfile in the project root directory to define process types
and explicitly declare what command should be executed to start your
app.Open the Procfile and add the line below:
web: gunicorn tabele.wsgi --log-file -
--log-file -
means "log to stdout". The--log-file
flag lets you
set a path to a log file, and-
means "stdout" (in this context).
web: gunicorn tabele.wsgi
ModuleNotFound error trying to open Django app in Heroku- issue with gunicorn setup?
#----------------------------Install packages----------------------------
1)pip install django-heroku
2)pip install whitenoise
#-----------------------------setting.py----------------------------------#
1)INSTALLED_APPS = [
...,
'django_heroku',
]
2)MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
]
3)STATICFILES_STORAGE =
'whitenoise.storage.CompressedManifestStaticFilesStorage'
4)STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
django_heroku.settings(locals())
#-----------------------urls.py---------------------------------------#
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
...,
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
#------------------Procfile create in Root DIR-----------------#
paste in (web: gunicorn projectname.wsgi)
#--------------create requirements.txt---------------------------#
pip freeze > requirements.txt
# runtime.txt create in Root DIR
paste in (your python version for ex.python-3.8.5)
#---------then commands in terminal-------------------------#
heroku login
heroku create YOUR_APP_NAME
##for Clone the repository.......
git init
heroku git:clone -a YOUR_APP_NAME
## for Deploy your changes......
git init
git add .
git commit - m "initial"
git push heroku master
## then
heroku run python manage.py migrate
heroku run python manage.py createsuperuser
Related Topics
In-Place Type Conversion of a Numpy Array
Wrapping Around on a List When List Index Is Out of Range
What Do Backticks Mean to the Python Interpreter? Example: 'Num'
Regex for Existence of Some Words Whose Order Doesn't Matter
How to Implement SQL Coalesce in Pandas
Setting Variables with Exec Inside a Function
Python Running as Windows Service: Oserror: [Winerror 6] the Handle Is Invalid
Why Does Numpy.Zeros Takes Up Little Space
Possible Values from Sys.Platform
How to Get Millisecond and Microsecond-Resolution Timestamps in Python
How to Ignore One Single Specific Line with Pylint
Memory Error When Using Pandas Read_Csv
Join Two Lists of Dictionaries on a Single Key
Syntax Error: Invalid Syntax' for No Apparent Reason
How to Display Utf-8 in Windows Console
Change Tick Frequency on X (Time, Not Number) Frequency in Matplotlib