i am developing a watch_logfiles.py script to monitor a file in my windows server.i have the script ready and running perfectly in the pycharm.but when i want to install this script as a service it says that it cannot find one of the imports.this import is a app which i created under the same django.app and it looks like this.
from myapp.views import myfunction
onyeibo
September 11, 2024, 7:35am
2
Is this a Django project? If so, it is not clear how this issue relates to Django.
What is the file path of watch_logfiles.py
? Can you share the import statement? We need more information to understand you problem
as you can see below is the project structure.and i have an app called files.which contains a view i would like to access this view from my watch_logfiles.py.
the watch+logfiles.py is in syslog folder as below
onyeibo
September 11, 2024, 8:15am
5
That is because syslog
is not a registered django app in your project.
How did you get the syslog folder? Did you run ./manage.py startapp syslog
? Did you add syslog to INSTALLED_APPS
list in your project/settings.py
?
If syslog is a third-party module, django may not recognize it. You need to tell django about it somewhere.
yes i did python manag.py startpp syslog. syslog is a registered app
INSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘mainpage.apps.MainpageConfig’,
‘files.apps.FilesConfig’,
‘userdata.apps.UserdataConfig’,
‘exchangeuserdata.apps.ExchangeuserdataConfig’,
‘citrixuserdata.apps.CitrixuserdataConfig’,
‘syslog.apps.SyslogConfig’,
‘export.apps.ExportConfig’
]
onyeibo
September 11, 2024, 8:26am
7
Dont forget to format code with "</>"
button. It makes your posts easier to read.
Example:
INSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘mainpage.apps.MainpageConfig’,
‘files.apps.FilesConfig’,
‘userdata.apps.UserdataConfig’,
‘exchangeuserdata.apps.ExchangeuserdataConfig’,
‘citrixuserdata.apps.CitrixuserdataConfig’,
‘syslog.apps.SyslogConfig’,
‘export.apps.ExportConfig’
]
I haven’t seen apps registered this way before except when the apps are external modules. I am talking about the following:
‘mainpage.apps.MainpageConfig’,
‘files.apps.FilesConfig’,
‘userdata.apps.UserdataConfig’,
‘exchangeuserdata.apps.ExchangeuserdataConfig’,
‘citrixuserdata.apps.CitrixuserdataConfig’,
‘syslog.apps.SyslogConfig’,
‘export.apps.ExportConfig’
for a local django app called “files”, registering it will look like this:
I
NSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
'files',
]
because i have been following this.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mainpage.apps.MainpageConfig',
'files.apps.FilesConfig',
'userdata.apps.UserdataConfig',
'exchangeuserdata.apps.ExchangeuserdataConfig',
'citrixuserdata.apps.CitrixuserdataConfig',
'syslog.apps.SyslogConfig',
'export.apps.ExportConfig'
]
the problem its works fine within pycharm even though theres an error indication