I am following this tutorial to hosting my django application on windows IIS Manager.
After following all steps from the tutorial I have got the following HTTP Error 500.0 - Internal Server Error
Is there any way to solve the issue?? I didn't find any solution for this...
I am using,
Python==3.10.0
Django==3.2.8
wfastcgi==3.0.0
IIS 10.0.17763.1
I had this same issue (Error code 0x00000067) and have been beating my head against a wall for 24 hours. I am new to Windows servers, but have been deploying Django Apps on Linux servers for over a decade.
In my case, I had deviated from the Johnnyboycurtis tutorial you referenced in a few ways:
I tried to install every python package in a virtual environment
I did not install Python at C:\, but rather hidden under my user's AppData\local\Programs\Python dir (the default)
I am assuming that your app works when running the Django Development server (py manage.py runserver -> http://localhost:8000 ) your app looks as expected (when DEBUG = True in settings.py)
Fixing my code install meant taking the following steps:
Navigating to C:\Users\MyUserName\AppData\local\Programs\Python, and following Johnnyboycurtis' instructions (but on Python310 instead of Python37) I added permissions for my AppPool to run Python.
I had to install wfastcgi OUTSIDE of my virtual environment:
deactivate (if you have a python virtual environment activated)
py -m pip install wfastcgi
Note that I did NOT have to change any other settings that were assuming my virtual environment:
web.config: 'scriptProcessor' still points to a python.exe and wfastcgi.py inside my virtual environment
IIS FastCGI Settings 'Full Path' and 'Arguments' both refer to files in my virtual environment
Related
I have a shared Cpanel host with the Litespeed web server. I want to deploy a Django application on it. After creating a Python application inside the Cpanel where I have not deployed the application on the host I try loading the website, and instead of displaying the Django version, I face 503 Unavailable!!
Also inside the "stderr.log" file, there is the following error.
/usr/local/lsws/fcgi-bin/lswsgi_wrapper: line 9: /opt/alt/python39/bin/lswsgi: No such file or directory
I'm creating the application with Python 3.9.
But it works when I create it with Python 3.8 and show the following message when I load the web,
It works!
Python 3.8.6
The issue is mostly caused by the lack of the Python 3.9 WSGI package. On out-of-date versions of LiteSpeed, the package needs to be installed manually.
To work around this, first ensure that LiteSpeed is up to date. LiteSpeed must be at version 5.4.10 for this to work. Once that is confirmed, execute the following script from LiteSpeed. It will pull the required Python Selector packages:
/usr/local/lsws/admin/misc/enable_ruby_python_selector.sh
Refer cpanel support
I have created a new Heroku site and I am developing it on my Linux box, using Django. The standard "getting started" site Heroku created for me is called "gettingstarted". How can I change that / configure Heroku to forget about it?
I was reading through the Django tutorial, which explains how to create a new site (django-admin startproject my_site). I did this successfully for a demo project. Then I tried to do it under the Heroku directory, because I wanted a better name for my site than "gettingstarted". I noticed that every time I start the Heroku server under my project, it says ...using settings 'gettingstarted.settings'. I found that this is configured in manage.py and I change it.
This is the directory layout I have
/some/path/heroku_random_name/gettingstarted/settings.py
/some/path/heroku_random_name/my_site/settings.py
/some/path/heroku_random_name/my_app
This is what I have in
/some/path/heroku_random_name/manage.py
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_site.settings')
so I would expect that the site that matters is my_site.
I got it to the point where I can run the site successfully on my local machine, and I can tell that it using the settings from my_site. But when I deploy the project to Heroku, it does not recognize my_app until I register it in gettingstarted/settings.py. In other words, when running in Heroku, it is still using gettingstarted as the site to run.
I am new to all this, so I left gettingstarted in the project, because I am afraid to break things. But how can I configure Heroku to execute settings from my_site and not from gettingstarted?
Found it: it's configured in Procfile.
It's confusing because it's configured in one place for running locally and in a different place for running hosted at Heroku.
I have transferred my Django project onto Linode server already. The project was developed in VS, within anaconda (base) environment on my Mac.
After I downloaded it onto the Linode server when activating it, it gave me too many dependencies (not all needed it seemed). One of them prevented me from completing the process.
So, I sudo installed (in venv) needed packages (within the project’s virtual environment), for example:
certifi,
chardet,
Django…,
After creating ’static’ in the settings.py, on the linode server, I tried to collect static :
~$ python manage.py collectstatic
BUT I am getting this Error message:
/home/..../django/users/models.py", line 16
return f'{self.user.username} Profile'
^
SyntaxError: invalid syntax
What is wrong here? How can I fix this error?
Check your python version. f strings are a fairly new feature, introduced with python 3.6. It's likely that you run an older version.
I'm trying to setup a django app with memcached. I have the app working via virtualenv on nitrous.io without memcached.
I ran parts install memcached which worked fine. python-memcached is also installed in the virtualenv. I tried running:
memcached -d -m memory -s $HOME/memcached.sock -P $HOME/memcached.pid
which I do on my production server. But I got this error:
failed to set rlimit for open files. Try starting as root or requesting smaller maxconns value.
The user rights and whatnot are a little out of my scope of knowledge?
You should always use parts start memcached to run the service on Nitrous.IO.
To change the configuration for the memcached package, edit /home/action/.parts/etc/memcached.conf.
I have been learning Django in the development mode for a two months and I am up to speed with most basic aspects of python + django now. However, I was using the built-in runserver till this time
Now, I have got a Webfaction hosting account and wanted to know the following
1) Webfaction sets up the project with a certain Django version (say 1.6.4) and Python version (say 2.7) initially
The project directory (for say project MYAPP) is /<>/webapps/MYAPP
When the site is running in production mode, how does the apache server know which Python version, and which site-packages versions to use with the MYAPP source code to render the site?
I can see that the MYAPP folder has a lib/python2.7 folder, however when I am connected to SSH terminal, and do a "which python", i see :
which python
/usr/local/bin/python
so, do I take that this is the Python executable that is being used for rendering the website instead of the one in webapps/MYSITE/lib/python2.7 folder? How does the information/data flow about which programs to use during rendering the site with apache mod_wsgi work?
2) I was using a virtualenv in the development mode during testing. How do I use this on webfaction in production mode?
3) I am using Pycharm IDE. It worked well for the development mode. I can see that it has a remote interpreter configuration and a Deployment setting/option.
The python path that the remote interpreter settings tool detects automatically is the python executable at /usr/local/bin/python
Is this fine, or should I be pointing it to the more local python2.7 in the webapps/lib folder?
Thanks a lot of the answers and pls let me know if you need any supplemental info
Note to the OP: This should really be three separate questions.
1) For WebFaction, your Django app will use the Python version (and libraries, etc.) defined in:
~/webapps/<appname>/apache2/conf/httpd.conf
Specifically, you'll want to look at what is defined for WSGIPythonPath (which should mostly match up with WSGIDaemonProcess unless you modify the config and are doing something strange).
Note that which python just tells you what the default python is in your shell. This has nothing to do with the config file for the webapp.
2) You may want to expand on this as to exactly what your use case is and why the default Django webapp created by WebFaction doesn't fit your needs. But the short answer is:
Create a virtualenv on your WebFaction account.
Install Django, etc. into the virtualenv.
Edit the httpd.conf file I mentioned above to use your virtualenv instead.
I've done this with both a Django webapp made via the WebFaction control panel and via a custom mod_wsgi webapp. So it does work. Just make sure to use the right Python version when making your virtualenv.
3) I don't use PyCharm so I can't answer this (one reason why this question should be split up).