Hi I have written a webApp with Mysql/mariadbe database since the client not a reliable internet line, I thought to compile the procedure and install it on a windows pc on the network so that it is accessible from multiple pc’s
Can you give me directions on how the installation should be done on windows pc which will act as server ?
Deployment to your Windows PC is effectively going to be the same as deployment to any other Windows-based system. You’ll need to decide which web server to use. (IIS? Apache? Nginx isn’t known to be great on Windows (see nginx for Windows), so I probably wouldn’t suggest it.)
How you choose to deploy it is going to affect what you need to do after that. (Apache is going to create different options than IIS) But it’s still going to involve installing Python and (optimally) a virtual environment for your project to run in.
Sorry for the question but as you know I’m not that experienced and I don’t want to make a mistake.
Currently on the development pc I have xampp installed for dataBase management and python, with PyCharm I use the terminal to launch the runserver.
On the client pc it is not clear to me if I have to install nginx (Apache would be xampp ?) and after the installation of nginx install the database and then the whole installation of python and django ?
If you could give me the sequence of operations to do or a link it would be better
It’s frequently said that learning how to deploy a Django project is one of the most confusing things you’ll ever do with Django - a statement with which I agree. One of the reasons for this is that so little of this process has anything to do with Django itself. You’re going to be working with a number of different things that you will not have normally encountered up to this point.
You’ll probably want to browse around and find specific blog posts specifically talking about deployment on Windows. (I don’t have any references, I’ve never deployed Django on Windows.)
But to answer your fundamental questions, yes. You will be installing a web server, database, Python and Django on the target system unless that system already has one or more of these components installed.
I also suggest you get access to a system to test this deployment process on before doing it on a client’s computer.
You are right, I need to install the webapp I wrote on a client’s windows pc that will act as a server for access from other pcs as well.
In doing so I need to figure out how to do it and especially avoid the client from accessing xampp, python and more (like installing python libraries) by taking code or modifying files.
For the python code I have seen that it can be compiled with PyInstaller
For the other things I need to figure out how to do it. Since there is no clear list for deployment, if I can and if you would like to follow along at the end of it all I can write one for local installation and the other on the web
Technically, that’s not quite what PyInstaller does, and fundamentally, what it does isn’t designed (or intended) to work with a deployed Django instance.
When you’re running Django in a production environment, you’re not running “Django”. You’re running some type of wsgi container or interface (e.g., uwsgi, gunicorn, mod_wsgi, daphne, etc) Whichever one is being used is running an instance of the Python runtime engine, and that is running Django (and your project) as a module.
You’re not going to find PyInstaller to be particularly helpful in this environment, if you can get it working properly at all.
Hi Ken, I’ll update you on developments. On a notebook I deleted the previous installations of xampp and python to start from scratch.
I installed xampp, python django, project and app.
Then I wrote the standard CIao Mond starting page in a view and it displays correctly.
Then I followed the instructions given in How to use Django with Apache and mod_wsgi (How to use Django with Apache and mod_wsgi | Django documentation | Django) and installed mod-wsgi (pip install mod-wsgi)
It returns the error
(GymGes) PS C:\xampp\htdocs\PalestraGes> pip install mod-wsgi
Collecting mod-wsgi
Using cached mod_wsgi-5.0.1.tar.gz (498 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Ottenere i requisiti per costruire la ruota non è stato eseguito con successo.
│ codice di uscita: 1
╰─> [23 righe di output]
Traceback (ultima chiamata):
File “C:\xampp\htdocs\PalestraGes\PalestraGes\Libsite-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py”, riga 353, in <module>
main()
~~~~^^
File “C:\xampp\htdocs\PalestraGes\PalestraGes\Libsite-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py”, riga 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\xampp\htdocs\PalestraGes\PalestraGes\Libsite-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py”, riga 118, in get_requires_for_build_wheel
return hook(config_settings)
File “C:\Users\Gaetano\AppData\Local\Temp\pip-build-env-ph5hncfm\overlay\Lib\site-packages\setuptools\build_meta.py”, riga 332, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Gaetano\AppData\Local\Temp\pip-build-env-ph5hncfm\overlay\Lib\site-packages\setuptools\build_meta.py”, riga 302, in _get_build_requires
self.run_setup()
~~~~~~~~~~~~~~^^
File “C:\Users\Gaetano\AppData\Local\Temp\pip-build-env-ph5hncfm\overlay\Lib\site-packages\setuptools\build_meta.py”, line 516, in run_setup
super().run_setup(setup_script=setup_script)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Gaetano\AppData\Local\Temp\pip-build-env-ph5hncfm\overlay\Lib\site-packages\setuptools\build_meta.py”, line 318, in run_setup
exec(code, locals())
~~~~^^^^^^^^^^^^^^^^
File “<string>”, line 81, in <module>.
RuntimeError: No Apache installation was found. Set the MOD_WSGI_APACHE_ROOTDIR environment to its location.
[end of output].
note: this error comes from a subprocess and is probably not a pip problem.
error: subprocess-exit-with-error
× Getting the requirements to build the wheel was not executed successfully.
│ output code: 1
╰─ See above for output.
note: this error comes from a subprocess and is probably not a pip problem.
I set the MOD_WSGI_APACHE_ROOTDIR environment variable to the value C:\xampp\apache.
But it always returns the same error
I followed the given procedure but nothing to do, what am I doing wrong
I’d be hoping that someone more familiar with a Windows-based deployment can jump in here.
If no one else here jumps in, the best advice I can give you is what I said above:
I’ve stopped deploying any web application on Windows more than 15 years ago. I’ve done some hunting around and haven’t found anything particularly useful.