antoinemartin / django-windows-tools Goto Github PK
View Code? Open in Web Editor NEWDjango application providing management commands to host Django projects in Windows environments
License: BSD 2-Clause "Simplified" License
Django application providing management commands to host Django projects in Windows environments
License: BSD 2-Clause "Simplified" License
python3.6(32bit)+django1.11.7+pyinstaller3.3+win7(64bit)
it's a helloworld. i can 'python server.py install' and start, listening port is ok, i can visit by 'http://localhost:18800/hello', which will show json response.
when i packed with pyinstaller, use [pyinstaller -n hello -y --add-data "hello\service.ini;." hello\service.py], and then run [dist\hello\hello.exe install] and start, no errors. i checked windows service state, it's running!
but run [netstat -ano | findstr 18800], no result, and fail to visit url.
what am i wrong ? or where the errors or exceptions are ? any suggestions ?
HI,
For windows 2008 R2 Portuguese, need change the file winservice_install.py to
users, domain, type = win32security.LookupAccountName ("", "Usuários")
admins, domain, type = win32security.LookupAccountName ("", "Administradores")
hello, I am facing a wired problem. in the command console, I am able to run "manage.py celeryd" and see the daemon is ready.
however when I install it as a service, seen from the process list, the pythonservice.exe first created 1 python process and 2 python sub-processes(should be 2 workers), and then the subprocesses and python process disappeared. checking the celery.log, it shows the same message that the daemon was ready as WARNING/MainProcess] celery@HOST ready.
the problem only happens in celeryd, but not celerybeat. celerybeat can be running without any problem.
celery version 3.0.10 and 3.1b1, both tried. broker: django database
django 1.4.2
thanks very much if you have the answers :)
Hi Guys,
I am trying to host a django project on my windows server 2012 using your django-windows-tools.
I successfully installed django-windows-tool and its dependencies. I successfully hosted my application in IIS using django-windows-tool. I am unable to access my website on my domain or localhost. IIS gives bad request 400 error.
Django development server is running without any error from the same directory on localhost:8000.
I checked my bindings. Bindings are correct. Because I can say that because I already hosted other webapps on the same server.
my web.config is:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<clear/>
<add name="FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Python36-32\python.exe|C:\inetpub\security\radrann\manage.py winfcgi --pythonpath=C:\inetpub\security\radrann" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
My project is hosted from : Initpub folder. I also checked for security settings.
Need to change python winservice_install to python manage.py winservice_install
Hi,
I like your work, but have an issues, that the service that was started fine, won't be terminated if I stop the service in the service.msc or via service.py stop.
If I run python manage.py process_tasks
manually it terminates when pressing <ctrl> + c
.
Is there anything else needed to make the command stoppable?
Thanks.
Thomas
Added a new site via django-windows-tools, any idea?
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
Python 2.6.6
x64 bit
Windows 10
Python 3.6.1
django-windows-tools 0.2
virtualenv located at D:\virtualenvs-36\venv-django_forms
services.ini:
[services]
run = celeryd celerybeat
clean = C:\Projects\Django\django_forms\logs\beat.log;C:\Projects\Django\django_forms\logs\celery.log
[celeryd]
command = celery
parameters = -A django_forms worker -P eventlet -f C:\Projects\Django\django_forms\logs\celery.log -l debug
[celerybeat]
command = celery
parameters = -A django_forms beat -f C:\Projects\Django\django_forms\logs\beat.log -l debug
[log]
filename = C:\Projects\Django\django_forms\logs\service.log
level = DEBUG
python service.py install
Installing service django-django_forms-service
Service installed
python service.py start
Starting service django-django_forms-service
Error starting service: The service did not respond to the start or control request in a timely fashion.
Windows Event Log:
The Django django_forms background service service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.
No .log files are created, the error messages appears instantly.
I've also tried setting the user on the service to myself with the same result.
I can run these two commands from two virtualenv activated consoles without any issue and everything works:
celery -A django_forms worker -l info -P eventlet
celery -A django_forms beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
I was previously able to get python manage.py winservice_install
working fine, but I was previously encountering an error with the services not starting up.
I came across this. In hopes of resolving the issue, so figured getting the most recent dev version would maybe fix things by pip install through git.
This ended up breaking it much more. I am not even sure where I should even get the value from. I have tried passing as an argument --service_name
, but winservice_install didn't like it. I tried python manage.py help winservice_install
, but didn't provide any insight on passing that specific or any type of relevant argument.
celery ( use django-windows-tools) gets this task and displays that it was received in the log (service.log), but does not starting task.
Error service.log
[INFO/Process-1] Starting command : C:\Program Files (x86)\Python36-32\lib\site-packages\django_windows_tools\service.py celeryd -f C:\www\logs\celery.log -l info
[ERROR/Process-1] Process 'Worker-8' pid:10248 exited with 'exitcode 1'
[ERROR/Process-1] Process 'Worker-7' pid:10928 exited with 'exitcode 1'
[ERROR/Process-1] Process 'Worker-6' pid:7892 exited with 'exitcode 1'
[ERROR/Process-1] Process 'Worker-5' pid:8664 exited with 'exitcode 1'
Celery == 3.1.25
Python == 3.6.3
django-celery == 3.2.2
celery == 3.1.25
django-windows-tools == 0.2
django == 1.11
wfastcgi == 3.0.0
redis
Windows Server 2016 Standard == 1607 (Build 14393.1198)
[services]
# Services to be run on all machines
run=celeryd
clean=C:\www\logs\celery.log
[BEATSERVER]
# There should be only one machine with the celerybeat service
run=celeryd celerybeat
clean=C:\www\logs\celerybeat.pid;C:\www\logs\beat.log;C:\www\logs\celery.log
[celeryd]
command=celeryd
parameters=-f C:\www\logs\celery.log -l info
[celerybeat]
command=celerybeat
parameters=-f C:\www\logs\beat.log -l info --pidfile=C:\www\logs\celerybeat.pid
[runserver]
# Runs the debug server and listen on port 8000
# This one is just an example to show that any manage command can be used
command=runserver
parameters=--noreload --insecure 0.0.0.0:8000
[log]
filename=C:\www\logs\service.log
level=INFO
My environment:
Windows 7
Python 2.7
django-windows-tools from git (updated today)
The service wasn't starting, so I tried running as:
$ python service.py debug
And the following error was issued:
WindowsError: (2, 'The system cannot find the file specified')
Debugging a little further, I found that the python interpreter was being wrongly found as %VIRTUALENV_PATH%\python.exe
, without the \Scripts\
in the path. For example, if the Virtualenv was in C:\MyVirtualenv\
, it assumed the interpreter was in C:\MyVirtualenv\python.exe
and not C:\MyVirtualenv\Scripts\python.exe
. Therefore it could not run the service.
Searching the web, I found that it is a known problem, but currently not fixed. If assumes python path is sys.exec_prefix
, when that is not always the case:
https://hg.python.org/cpython/file/e55f955659bc/Lib/multiprocessing/forking.py
Virtualenv people have claimed no responsibility about it:
One ugly, but working fix would be running this in the beginning of your service.py
:
sys.exec_prefix = sys.exec_prefix + "\\Scripts\\"
Is there any chance that this will be updated to support python 3?
I am sorry to say that I have not been able to use django-windows-tools
for deploying.
I have however found a simple way of deploying in IIS with wfastcgi and will share my experiences in the hope that it may improve this project.
Basically I added a FastCGI application from my virtual environment with full path being [venv_root]\Scripts\python.exe
and arguments being [venv_root]\Lib\site-packages\wfastcgi.py
.
This is automated by wfastcgi by the installed command wfastcgi-enable
(there is also a wfastcgi-disable
for removing it again).
Then I add my site root as a new site using the following template to create the web.config
(Note that [site_root]
, [venv_root]
and [project_module]
must be replaced):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<clear/>
<add name="FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="[venv_root]\Scripts\python.exe|[venv_root]\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="PYTHONPATH" value="[site_root]" />
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
<add key="DJANGO_SETTINGS_MODULE" value="[project_module].settings" />
<add key="DEBUG" value="False" />
<!-- Optional settings -->
<!--<add key="WSGI_LOG" value="[log_path]" />-->
</appSettings>
<!-- Serve the collected static files -->
<location path="static">
<system.webServer>
<handlers>
<clear/>
<add name="StaticFiles" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read"/>
</handlers>
</system.webServer>
</location>
</configuration>
This setup requires that STATIC_URL = '/static/'
and STATIC_ROOT = os.path.join(BASE_DIR, 'static')
to avoid creating a virtual directory in IIS, but I guess that can be automated.
You may also want to give full access to the site root to the app pool user.
Other than that, my only caveat is that I don't use MEDIA in my project, but I guess that is just a matter of repeating the procedure for static.
I'm using Django 1.9.13
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "c:\python27\Lib\site-packages\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "c:\python27\Lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "c:\python27\Lib\site-packages\wfastcgi.py", line 605, in get_wsgi_handler
handler = handler()
File ".\ptvs_virtualenv_proxy.py", line 102, in get_virtualenv_handler
handler = get_wsgi_handler(os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
File ".\ptvs_virtualenv_proxy.py", line 76, in get_wsgi_handler
handler = getattr(handler, name)
AttributeError: 'module' object has no attribute
I've been looking for the cause, but couldn't find it yet
I am using a project structure where the settings and root urls.py still reside in a subfolder (Django 1.6 application that I just upgraded to Django 1.9). I have moved the wsgi.py from this subfolder up one level, thinking that might help ...
Hi Martin,
When I create a new project and follow the steps that you have described your document to start the Django project as the windows process is working fine. But the same when I apply to my project that has MongoDB connectivity in the settings file it fails to start giving the following error log.
When ran with net start service name
[INFO/Process-1] Starting command : C:\Python\Python37\lib\site-packages\django_windows_tools\service.py runserver --noreload --insecure 0.0.0.0:8000
[INFO/Process-1] process shutting down
[INFO/Process-1] process exiting with exitcode 0
When ran with python service.py debug
[INFO/Process-1] Starting command : C:\Python\Python37\lib\site-packages\django_windows_tools\service.py runserver --noreload --insecure 0.0.0.0:8000
[INFO/Process-1] [19/Feb/2020 11:59:04] "GET / HTTP/1.1" 200 750
[INFO/Process-1] [19/Feb/2020 11:59:04] "GET /static/assets/2.jpg HTTP/1.1" 200 32374
[INFO/Process-1] [19/Feb/2020 11:59:04] "GET /static/assets/logo.ico HTTP/1.1" 200 4725
I have done the service.py install/update but still, the issue is same
settings.py file:
"""
Django settings for DS_CENTRAL project.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
from pathlib import Path
from pymongo import MongoClient
from socket import gethostname, gethostbyname
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xxxx'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['*']
APPEND_SLASH=False
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'django_windows_tools',
]
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_WHITELIST = ()
CORS_ORIGIN_REGEX_WHITELIST = ()
CORS_ALLOW_HEADERS = ('x-requested-with', 'content-type', 'accept', 'origin', 'authorization', 'x-csrf-token', 'token',)
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'corsheaders.middleware.CorsMiddleware',
]
ROOT_URLCONF = 'DS_CENTRAL.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'DS_CENTRAL.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
client = MongoClient('localhost', 27017)
DATABASE = client.DS_CENTRAL_Q
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
STATIC_URL = '/static/'
MEDIA_URL = ''
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
print (STATIC_ROOT)
Path(STATIC_ROOT).mkdir(parents=True, exist_ok=True)
MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'static')
Path(MEDIA_ROOT).mkdir(parents=True, exist_ok=True)
print (MEDIA_ROOT)
EXCEL_UPLOADS = os.path.join(BASE_DIR,'static', 'static','uploads')
Path(EXCEL_UPLOADS).mkdir(parents=True, exist_ok=True)
LogFile_PATH = os.path.join(BASE_DIR,'static', 'static','logs')
Path(LogFile_PATH).mkdir(parents=True, exist_ok=True)
# setting the maximum request data size to 10 MB
DATA_UPLOAD_MAX_MEMORY_SIZE = 1000000000
ACTION_MAIL = []
service.py
#!/usr/bin/env python
import os
import os.path
import sys
import win32serviceutil
# This is my base path
base_path = os.path.dirname(os.path.abspath(__file__))
print ('base_path = ', base_path)
if not base_path in sys.path:
sys.path.append(base_path)
print (sys.path.append(base_path))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DS_CENTRAL.settings")
from django_windows_tools.service import DjangoService,test_commands
class Service(DjangoService):
_base_path = base_path
_svc_name_ = "django-DsCentral-service"
_svc_display_name_ = "Django DS_CENTRAL background service"
_config_filename = "service.ini"
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == 'test':
test_commands(base_path)
else:
win32serviceutil.HandleCommandLine(Service)
service.ini
[services]
# Services to be run on all machines
run=runserver
clean=C:\Users\LineProject\Desktop\static\static\logs\service.log
# [BEATSERVER]
# There should be only one machine with the celerybeat service
# run=celeryd celerybeat
# clean=d:\logs\celerybeat.pid;d:\logs\beat.log;d:\logs\celery.log
# [celeryd]
# command=celeryd
# parameters=-f d:\logs\celery.log -l info
# [celerybeat]
# command=celerybeat
# parameters=-f d:\logs\beat.log -l info --pidfile=d:\logs\celerybeat.pid
[runserver]
# Runs the debug server and listen on port 8000
# This one is just an example to show that any manage command can be used
command=runserver
parameters=--noreload --insecure 0.0.0.0:8000
[log]
filename=C:\Users\LineProject\Desktop\static\static\logs\service.log
level=DEBUG
service.log
[INFO/Process-1] Starting command : C:\Python\Python37\lib\site-packages\django_windows_tools\service.py runserver --noreload --insecure 0.0.0.0:8000
[INFO/Process-1] process shutting down
[DEBUG/Process-1] running all "atexit" finalizers with priority >= 0
[DEBUG/Process-1] running the remaining "atexit" finalizers
[INFO/Process-1] process exiting with exitcode 0
Thanks & regards,
Mayur Kumar Sharma
I have enabled CGI support following these instructions: http://www.iis.net/configreference/system.webserver/cgi
Running on Windows 7 Ultimate 64bits.
When running winfcgi_install command I get the error:
CommandError: It seems that The CGI module is not installed
Not sure how to fix this, as the CGI module is actually installed, I can see it in the IIS Manager.
Here is my service.ini.
https://dpaste.de/idm5
The service shows running. But nothing happens. Also, is it not celerybeat deprecated and should be replaced with celery beat command.
I am confused about where to get celerybeat.pid file in log folder as well. All tutorial gives same example which is not working. I am using windows 7 64 bit and celery 3.1.17
Thanks
I have followed the guide for setting up celery services here.
I have adjusted parameters to work for my settings and still fails to start up properly when I check the task manager.
It shows I have a django-myapp-service
created.
Here is my services.ini file:
[services]
# Services to be run on all machines
run=celeryworker
clean=C:\inetpub\wwwroot\Django\BPTS\myapp\logs\celery.log
[BEATSERVER]
# There should be only one machine with the celerybeat service
run=celeryworker celerybeat
clean=C:\inetpub\wwwroot\Django\BPTS\myapp\logs\celerybeat.pid;C:\inetpub\wwwroot\Django\BPTS\myapp\logs\beat.log;C:\inetpub\wwwroot\Django\BPTS\myapp\logs\celery.log
[celeryworker]
command=celery worker
parameters=--app=myapp.celery -f C:\inetpub\wwwroot\Django\BPTS\myapp\logs\celery.log -l info
[celerybeat]
command=celery beat
parameters=--app=myapp.celery -f C:\inetpub\wwwroot\Django\BPTS\myapp\logs\beat.log -l info --pidfile=C:\inetpub\wwwroot\Django\BPTS\myapp\logs\celerybeat.pid
[runserver]
# Runs the debug server and listen on port 8000
# This one is just an example to show that any manage command can be used
command=runserver
parameters=--noreload --insecure 0.0.0.0:8000
[log]
filename=C:\inetpub\wwwroot\Django\BPTS\myapp\logs\service.log
level=INFO
Taking apart these commands and parameters I manually input them
python manage.py celery worker --app=myapp.celery -f C:\inetpub\wwwroot\Django\BPTS\myapp\logs\celery.log -l info
python manage.py celery beat --app=trackingsystem.celery -f C:\inetpub\wwwroot\Django\BPTS\trackingsystem\logs\beat.log -l info --pidfile=C:\inetpub\wwwroot\Django\BPTS\trackingsystem\logs\celerybeat.pid
and they work properly.
Hi,
I am trying to deploy my django application on windows but I am currently running into an issue when I run this command in an admin-privilaged windows powershell:
C:\Python27\python.exe "C:\manage.py" winfcgi_install --binding="http://localhost:8080"
ERROR ( message:New application object missing required attributes. Cannot add duplicate collection entry of type 'application' with combined key attributes 'fullPath, arguments' respectively set to 'C:\Python27\python.exe, C:\manage.py winfcgi --pythonpath=C:'. )
Can anyone provide help with what might be causing this issue?
I have been getting an error with FastCGI when I try to use the django-windows-tool to configure my Django Project to run on IIS. When I run python manage.py winfcgi_install
while in my virtual environment, a new web.config
file, a new app pool, a new FastCGI application, and a new web site all appear as intended. I bind the website to a new port, then change the app pool Identity from "ApplicationPoolIdentity" to "LocalSystem". However, after navigating to the website I get an error.
HTTP Error 500.0 - Internal Server Error
C:\Users\Clay.MDMI\PyRO\myvenv\Scripts\python.exe - The FastCGI process exited unexpectedly
Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Module | FastCgiModule
Notification | ExecuteRequestHandler
Notification | FastCGI
Error Code | 0x00000001
Requested URL | http://localhost:81/
Physical Path | c:\users\clay.mdmi\pyro\proj
Logon Method | Anonymous
Logon User | Anonymous
Obviously, this error message isn't super helpful. After a suggestion on another issue here, I tried adding lines to my web.config
file shown below to have it print more information, but it doesn't change the result.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpErrors errorMode="Detailed" />
<handlers>
<clear/>
<add name="FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\Clay.MDMI\PyRO\myvenv\Scripts\python.exe|C:\Users\Clay.MDMI\PyRO\proj\manage.py winfcgi --pythonpath=C:\Users\Clay.MDMI\PyRO\proj" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
I saw some people talking about needing to grant the app pool permission to the project directory, so I followed the instructions HERE (performed on the root folder, changed permissions for all folders inside as well) but nothing changed.
Any ideas on next steps? Could this be an issue with my virtual environment?
I very much appreciate any help, as well as the fact that this tool just exists in the first place!
More info:
Django v2.1
Anaconda v5.2
Python v3.6.3
IIS v10
The exception is the following:
(my-service) C:\sites\my-service>python manage.py help winfcgi_install
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\venv\my-service\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:\venv\my-service\lib\site-packages\django\core\management\__init__.py", line 348, in execute
self.fetch_command(options.args[0]).print_help(self.prog_name, options.args[0])
File "C:\venv\my-service\lib\site-packages\django\core\management\base.py", line 264, in print_help
parser.print_help()
File "c:\python36\Lib\argparse.py", line 2366, in print_help
self._print_message(self.format_help(), file)
File "c:\python36\Lib\argparse.py", line 2350, in format_help
return formatter.format_help()
File "c:\python36\Lib\argparse.py", line 282, in format_help
help = self._root_section.format_help()
File "c:\python36\Lib\argparse.py", line 213, in format_help
item_help = join([func(*args) for func, args in self.items])
File "c:\python36\Lib\argparse.py", line 213, in <listcomp>
item_help = join([func(*args) for func, args in self.items])
File "c:\python36\Lib\argparse.py", line 213, in format_help
item_help = join([func(*args) for func, args in self.items])
File "c:\python36\Lib\argparse.py", line 213, in <listcomp>
item_help = join([func(*args) for func, args in self.items])
File "c:\python36\Lib\argparse.py", line 523, in _format_action
help_text = self._expand_help(action)
File "c:\python36\Lib\argparse.py", line 610, in _expand_help
return self._get_help_string(action) % params
ValueError: unsupported format character 'S' (0x53) at index 41
Celeryd dies in a very fast fashion. but celerybeat works correctly.
Error Message as I executed the command:
python service.py debug
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\billiard\forking.py", line 503, in main
prepare(preparation_data)
File "C:\Python27\lib\site-packages\billiard\forking.py", line 644, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named PythonService
[services]
run=celeryd
clean=c:\logs\celeryd.pid;c:\logs\celerybeat.pid
[celeryd]
command=celeryd
parameters=-f c:\logs\celery.log -l debug --settings=rcs_main.win_dev
[celerybeat]
command=celerybeat
parameters=-f c:\logs\beat.log -l info --pidfile=c:\logs\celerybeat.pid --settings=rcs_main.win_dev
[runserver]
command=runserver
parameters=--noreload --insecure 0.0.0.0:8000
[log]
filename=c:\logs\service.log
level=INFO
Here is my log
[INFO/Process-1] Starting command : C:\Python27\lib\site-packages\django_windows_tools\service.pyc celeryd -f c:\logs\celery.log -l debug --settings=rcs_main.win_dev
[ERROR/Process-1] Process 'PoolWorker-1' pid:2568 exited with exitcode 1
[ERROR/Process-1] Process 'PoolWorker-2' pid:2196 exited with exitcode 1
[ERROR/Process-1] Process 'PoolWorker-3' pid:708 exited with exitcode 1
[ERROR/Process-1] Process 'PoolWorker-4' pid:4016 exited with exitcode 1
[ERROR/Process-1] Process 'PoolWorker-5' pid:3828 exited with exitcode 1
[ERROR/Process-1] Process 'PoolWorker-6' pid:3416 exited with exitcode 1
[ERROR/Process-1] Process 'PoolWorker-7' pid:3228 exited with exitcode 1
[ERROR/Process-1] Process 'PoolWorker-8' pid:1348 exited with exitcode 1
This is almost a duplicate of issue #1.
The fix in winservice_install (lookup groups by SID instead of name) has not been merged into wincfgi_install, where the code for set_file_readable() is duplicated. This makes it unusable on a non-English Windows (German, in my case). Applying the fix resolves the issue.
When installing django-windows-tools
it should automatically install pypiwin32
as a dependency. This does not happen currently.
Just started using django-windows-tools. My project works fine with Django development server (python manage.py runserver). After running 'python manage.py collectstatic', I create the fgci app with 'python manage.py winfcgi_install --binding=http://localhost:80' (as Administrator). When I try to access any page (e.g. http://localhost/) via browser, I get a Server Error, 500.0, "The FastCGI process exited unexpectedly". Info from the error page:
Detailed Error Information
Module FastCgiModule
Notification ExecuteRequestHandler
Handler FastCGI
Error Code 0x00000001
Requested URL http://localhost:80/
Physical Path c:\myprojectdir
Logon Method Anonymous
Logon User Anonymous
The error page also mentions:
Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
I am running with virtualenv (looks like the script processor for fgci is correctly set to the virtualenv's path/.exe).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.