I have configured my Django project on Openshift with success.
But somewhere in my site I launch a command tool installed by pip and I think the command failed.
But I don't find python log with
rhc tail -a project
Or when I got to /var/lib/openshift/id/app-root/logs/python.log file I don't find more log than displayed at screen
How can I see all my python output console ?
Thanks
[EDIT]
I tried to use the logging configuration for django, but I can't see my log even if I put my app name in loggers.
Your log files are at the directory specified by OPENSHIFT_LOG_DIR environment variable. If you want to have custom log files, you should also write them there.
You can find more information on the log files here: https://developers.openshift.com/managing-your-applications/log-files.html
Related
I want to run a python app called Flask on shared hosting but I don't have access to bash or command prompt or ssh but I am provided with:
Well, that's okay! Let me explain what I see in case the image cant be seen
Configuration files: A button that says RUN PIP INSTALL
A text field that says: Enter another file and press enter
Environment variables and an ADD button.
I know how to do this on my local machine
pip install flask
But how do I do it on the shared hosting?
I have a virtual environment that is just a folder but I can't access it since no ssh but it looks like
Well, I have figured it out and I want to share my experience here.
step 1.
on the cpanel, scroll and find python under software and click it.
step 2.
creat application
select python version
application root is where you will upload your data
Application startup file is and should be: init.py
Application Entry point will be: application
Passenger log file: blog.log
click create
step 3
open passenger_wsgi.py and type:
import os
import sys
from init import app as application
sys.path.insert(0, os.path.dirname(file))
save
step 4
creat you app on your lacal machine and pip freeze all requirement
copy the requirement.txt files and upload it to your application root folder and
click python again from your cpanel software and click edit your application
on Configuration files, type your requirement .txt and click add
then keep building your app on your lacal machine and upload your files they will run
This video was the best tutorial I could find on how to properly configure a shared host (cPanel/Phusion Passenger) to work with Flask.
The only other thing I do to avoid the importlib nagging warning
DeprecationWarning: the imp module is deprecated in favour of
importlib; see the module's documentation for alternative uses
is to change the default passenger_wsgi.py contents to
from app import app as application
Beware that this file might be rewritten when changing the application through the cPanel page.
I have a python web app running fine on azure. I can access it using the url http://<name>.azurewebsites.net/api/v1/. In python project, I also have logging file where I am saving all the logs of the project.
Previously I used to access the log file using the kudu console but now when I try to open the kudu console, I get below error:
But in actual the web app is running. I am not able to access the kudu console. How can I access it to view my log file and other files inside the project. Please help. Thanks
You may be running into Quota issues if your site is in SHARED mode. Try upgrading to STANDARD infrastructure mode.
You may try to access KUDU by appending your AAD details in the URL.
For eg: https://<name>.scm.azurewebsites.net/#XXX.onmicrosoft.com where XXX is the name for your directory.
How to get the directory details?
Click on "Directory + Subscription" tab. It will display the details on the directory you are logged in.
I need to see the logs that generated from a python application. This python application runs in a miniconda environment.Is there a way I can check the logs ?
I don't know whether I understand the question correctly. In case your application is using logging object (ref. https://docs.python.org/3/library/logging.html) then your output could either be in:
Console: from which the application was started
File: in case that you specified the logging output to a file
It depends on your configuration and on the logging level as well. Some applications (like Django) use their own configuration to log.
I'm trying to use multiple modules in google app engine.
i try using this source code:
https://github.com/GoogleCloudPlatform/appengine-modules-helloworld-python
but i cant seem to find a way to run from pycharm with all the .yaml loaded, so only the app.yaml seem to load.
also when trying to upload the code to the appengine (using pycharm) i cant seem to upload all.
is there a way to solve it?
i saw similar question :
Run App Engine development server with modules in PyCharm
but no answer i could figure +
he didnt talked about uploading it to the appengine.
this are the logs :
"C:\PyCharm 4.0.5\bin\runnerw.exe" C:\Python27\python.exe "C:/Program Files (x86)/Google/google_appengine/dev_appserver.py" --host 127.0.0.1 .
INFO 2015-04-24 17:14:31,730 sdk_update_checker.py:229] Checking for updates to the SDK.
WARNING 2015-04-24 17:14:33,382 simple_search_stub.py:1126] Could not read search indexes from c:\users\ishwartz\appdata\local\temp\appengine.pythonfortau\search_indexes
INFO 2015-04-24 17:14:33,401 api_server.py:172] Starting API server at: http://localhost:60656
INFO 2015-04-24 17:14:33,414 dispatcher.py:186] Starting module "default" running at: http://127.0.0.1:8080
INFO 2015-04-24 17:14:33,424 admin_server.py:118] Starting admin server at: http://localhost:8000
nothing strange, they just ignore the other modules.
thanks.
FWIW, I was able to run a multi-module project on the devserver after adding the location of each module's .yaml file relative to the project dir in the Additional options section of the Run -> Edit Configurations menu.
Note: I'm using PyCharm 4.0.6 which has the fix for
PY-10675 - the subject of the similar question you mentioned.
This line in your Run log indicates you don't have the .yaml files for your modules included in the run configurations, it's just running with the default settings:
... (x86)/Google/google_appengine/dev_appserver.py" --host 127.0.0.1 .
Add these to your run configurations:
app.yaml mobile_frontend.yaml static_backend.yaml
With these configs in place you should see something like this in the first line of the Run log:
... (x86)/Google/google_appengine/dev_appserver.py" --host 127.0.0.1 app.yaml mobile_frontend.yaml static_backend.yaml
I'm not 100% sure if dispatch.yaml should also be included (I didn't yet use a dispatcher file in my projects) - follow the messages displayed in the Run console and try to add it as well if needed.
But I am stuck as well at the upload stage as I can't find a place for similar upload configs.
Confirmed by JetBrains as an issue, tracked as PY-15686.
Manual uploads appear to be the only workaround for now.
I have 3 standalone python applications in python Virtual env in mog_wsgi modein same server. I installed newrelic in 1st application python virtual environment and its showing fine in newrelic GUI page.
when i followed and installed same thing for 2nd and 3rd application in respective python Virtual env. but these 2 applications are not showing in Newrelic GUI application page.
For all 3 applications log file is not updating from starting.
Please help me out to configure and integrate multiple python apps which are hosted in a single server python env.
below are steps that i have followed.
centos OS
Install the New Relic Python agent in apps virtual env
source <virtual path>
pip install newrelic
pip freeze
Generate config file:
cd /etc/newrelic/
newrelic-admin generate-config <Licence Key> newrelic.ini
Validate the conf file:
newrelic-admin validate-config newrelic.ini
Configure the variables in conf file
logfile = log file name
loglevel=info
app_name = name
Integrate the appliactions mod_wsgi file with NewRelic:
Adding below in wsgi.py file
vi wsgi.py
import newrelic.agent
newrelic.agent.initialize('/etc/newrelic/newrelic.ini')
installed newrelic version is "newrelic==2.12.0.10"
Please help me.
Thank you,
subhani466#gmail.com
I know that you have posted this a while ago, but the solution I've found was to install newrelic pip install newrelic outside of virtual envs.
Anyone that is facing this issue just install new relic outside the virtual envs.
I'm a little unclear on your setup. If you have all three Python apps in the same virtual environment and you're using newrelic.ini for all three, then all three applications will report to the same UI listing. You need to either name the config files differently (newrelic.ini, newrelic2.ini, newrelic3.ini) and reference them likewise, or split the applications into separate virtual environments.
As for the log files not writing, it sounds like you don't have user rights to that directory. You can read more about this in the New Relic docs, here: https://docs.newrelic.com/docs/python/python-agent-logging
The path provided for 'log_file' should be writable to the user that
your application runs as. If using Apache/mod_wsgi that would usually
be the Apache user which has restricted access to the filesystem. You
might therefore need to create a special directory into which the log
file can be placed which is writable to the Apache user. Because the
current working directory of an application could be anything, it is
recommended that an absolute path and not a relative path be used.
If you need more help, please open a ticket with us at http://support.newrelic.com
It looks like you are using one config file for three applications.
They all have the same app_name.
Therefore, you have one APM displayed in the UI.
Remove the app_name line from newrelic.ini and pass a unique variable NEW_RELIC_APP_NAME to each app.