As pythonanywhere is the one of best place to host python web app. And apps will be hosted as per wsgi.py configurations on it's own server. But what happens when I do something like this on its bash shell?
$ python manage.py runserver 127.0.0.1:9000
Performing system checks...
System check identified no issues (0 silenced).
April 28, 2016 - 15:29:48
Django version 1.9.5, using settings 'MyProject.settings'
Starting development server at http://127.0.0.1:9000/
Quit the server with CONTROL-C.
As you can see I had changed the port to :9000, so is there any way to access this or it's just meaningless as it's serving the app on served server service?
PythonAnywhere dev here. There's no way to access a server you run using manage.py runserver. It will try to bind to a local port, but that port isn't visible from outside the PythonAnywhere cluster.
[edit] Oh, and thank you for the kind words about PythonAnywhere!
Related
I have been following this tutorial for a moment but I don't know why it isn't working:
https://github.com/anapsix/zabbix-haproxy/blob/master/README.md
To make a long story short:
I have a Zabbix server on Amazon EC2 and I want to monitor a HAproxy server which is inside my network. The HAProxy Server has a Zabbix Agent working on it.
The tutorial explain how to setup a script for the zabbix-agent to explore what's behind it (what's the haproxy is load-balancing) and send it back to the Zabbix Server.
However everything is working fine but nothing shows up on the Zabbix server, no host are discovered despite the zabbix agent and server are communicating.
1 - I did place the userparameter_haproxy.conf into /etc/zabbix/zabbix_agentd.d/ and
set it in the zabbix_agend.conf file.
2 - I did place the haproxy_discovery.sh into /usr/local/bin/ and gave it the +x rights
3 - I did import haproxy_zbx_template.xml
4 - Configure HAProxy control socket: I assume there is my mistake.
5- The scripts are working because I get result when I execute this commands:
zabbix_agentd -t haproxy.list.discovery[FRONTEND]
zabbix_agentd -t haproxy.list.discovery[BACKEND]
zabbix_agentd -t haproxy.list.discovery[SERVERS]
6 - I added the host with HAproxy on it to the right template
7 - I can wait forever nothing is showing up, no new hosts.
I think the step 4 is where I am doing wrong. In the tutorial they say:
Configure HAProxy to listen on /var/run/haproxy/info.sock or set
custom socket path in checks (set {$HAPROXY_SOCK} template macro to
your custom socket path) or update userparameter_haproxy.conf and
haproxy_discovery.sh with your socket path
I did make the haproxy.cfg file listen to the file /var/lib/haproxy/stats
and set a custom socket path in the template macro.
Additionnal info:
Version of Zabbix: 3.4
Zabbix Server: RHEL 7.4
Zabbix Agent: Centos 7.2
No errors when I restart zabbix-agent
No errors in haproxy.log
UPDATE: I did add Zabbix to the root group.
Now, in Zabbix server logs I can see this message:
changed: Value "which: no nc in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
2" of type "string" is not suitable for value type "Numeric (unsigned)"
And I'm lost again.
UPDATE: I was missing netcat, I installed it on the zabbix server and client.
UPDATE: It's working
According to your update, I guess netcat (nc) is not installed on your system.
Install it and try again
I am currently deploying to Digital Ocean using Meteor Up. If I don't specify a MONGO_URL in the mup.json, can I get the value from the command line while the website is running, i.e. I don't want to shutdown the site?
If I go to the app directory and run meteor mongo --url, I get the following error:
mongo: Meteor isn't running a local MongoDB server.
This command only works while Meteor is running your application
locally. Start your application first. (This error will also occur if
you asked Meteor to use a different MongoDB server with $MONGO_URL when
you ran your application.)
If you're trying to connect to the database of an app you deployed
with 'meteor deploy', specify your site's name with this command.
Even if I run the app from the app directory, it will only give the localhost MONGO_URL. I need the MONGO_URL for the deployed app.
I have also taken a look at a similar question as suggested by some of the answers. I disagree that it is "impossible" to get the MONGO_URL without some other program running on the server. It's not as if we are defying the laws of physics here, folks. Fundamentally, there should be a way to access it. Just because no one has yet figured it out doesn't mean it is impossible.
meteor mongo --url should return the URL.
Try opening another shell in the app directory and running that command.
Meteor Up packages your app in production mode with meteor build so that it runs via node rather than the meteor command line interface. Among other things, this means meteor foo won't work on the remote server (at least not by default). So what you're really looking for is a way to access mongo itself remotely.
I recently set up mongo on an AWS EC2 instance and listed some lessons learned here: https://stackoverflow.com/a/28846703/2669596. Some details of how you do it are going to be different on Digital Ocean, but these are the main things you have to take care of once mongo itself is installed:
Public IP/DNS Address: This is probably fine already since you can deploy to the server.
Port Security Rules: You need to make sure port 27017 is open for TCP access, at least from your IP address. MongoDB also has an http interface you can set up; if you want to use that you'll need to open 28017 as well.
/etc/mongod.conf (file location may differ depending on Linux flavor):
Uncomment port=27017 to make sure you have the default port (I don't think this is actually necessary, but it made me feel better and it's good to know where to change the default port...).
Comment out bind_ip=127.0.0.1 in order to listen to external interfaces (e.g. remote connections).
Uncomment httpinterface=true if you want to use the http interface.
You may have to restart the mongod host via sudo service mongod restart. That's a problem if you can't have downtime, but I don't know of a way around that if you change the config file.
Create User: You need to create an admin and/or user to access the database remotely.
Once you've done all of that, you should be able to access the database from your local machine (assuming you have the mongo client installed locally) by running
mongo server.url.com:27017/mup-app-name -u username -p
where server.url.com is the URL or IP address of your remote server, mup-app-name is the appName parameter from your mup.json file, username is the user you created to access the database, and you'll be prompted for that user's password after you run the command (or you could put it after -p on the same line, depending on the password).
There may also be a way to do this by setting up nginx to reverse-proxy 127.0.0.1:27017 on your remote server, but I've never done it and that's just me speculating.
I have developed a simple application in Eclipse & Django & Pydev. The application fails while starting and I am given the following error:
*Error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions*
I have tried changing the port number to 8080 in Eclipse by changing the Run Configurations, but this has failed.
How can solve this problem and host my Django application on other port?
If you are willing to do this outside of Eclipse, you can run the Django development server on a different port with
python manage.py runserver PORT_HERE
For example, to use port 8005, you can do
python manage.py runserver 8005
i have a little issue with a Jboss AS 4.2.3 . I'm developing an application in Seam so i'm using Jboss as server. In the client company they have a Jboss AS 4.2.3 installed on Fedora and configured as a service, so it starts automatically on boot machine with PostgreSQL. So, if i run chkconfig --list i can see Jboss here as a service.
But the problem is when i try to restart, stop or start this service (i have root permissions) using this command:
service jboss stop/restart
But i don't know what happens that looks like it doesn't find the Jboss AS instance that's running because i get this message:
JOBSS_CMD_START = cd /opt/java/jboss/bin; /opt/java/jboss/bin/run.sh -c default
No JBossas is currently running
But it's running because if i enter localhost:8080 on a browser it loads the Jboss page. The server admin of the company doesn't know also why the service can't restart or stop or start and only i know that he followed this tutorial to install and configure JBoss AS:
thewiki4opentech.org/index.php/How_to_install_JBoss_AS_in_CentOS_/RedHat/_Fedora
Also, i tried with
/etc/init.d/jboss stop
And i get the same output. If i use
/opt/java/jboss/bin/start.sh -c default
It tries to start a second instance of Jboss AS but it gives me errors because is trying to use the same ports as already started Jboss instance.
And it's difficult to me because i'm connecting remotely using Teamviewer and i want to deploy an EAR but i can't because i can't restart the service to extract the ear. So i wanna ask you for help if you know why the Jboss AS that's running can't be stopped or started using service jboss stop.
As aditional info, i'm using the config to access Jboss apps from other machines (using 0.0.0.0) and the server has a static IP. The config of my hosts file is this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.106 entertechserver.localdomain entertechserver
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Regards.
Well, i think that i found the answer. The server admin copy the script run.sh to /etc/init.d/ but we saw that there's another script named jboss_init_redhat.sh that i think is optimized for redhat/fedora systems, so we used this script to copy to /etc/init.d/ and it works!! Now when i stop it gives me the next output:
JBOSS_CMD_START = cd /opt/java/jboss/bin; /opt/java/jboss/bin/run.sh -c default -b 0.0.0.0
waiting for processes to stop
Really i haven't seen the difference between both scripts yet but it will be intersting to take a look.
Regards.
I apologize for such a beginner question, but I'm stuck. I'm starting learn web development and I want to test out something I am hosting locally using Django runserver command. I would like to test it on my iPhone. According to this question, I just need to point my iPhone to my Windows 7 ip address (which I found through ipconfig). When I try to, I get the error: "Safari could not open the page because the server stopped responding" (a time-out).
Is there anything else that I need to do?
In addition to using the correct IP, your runserver command should listen on 0.0.0.0(all IPs).
runserver 0.0.0.0:8000
Below steps worked for me on MAC OS 10.10.3
python manage.py runserver 0.0.0.0:8000
in terminal window "ipconfig getifaddr en0" returned IP address 10.0.1.22
open browser in Iphone/Ipad "http://10.0.1.22:8000"
You need to use the IP address AND port that the runserver is running on... this is usually :8080 or whatever number that follows the IP it reports when it runs the server.
so if the runserver command reports...
http://127.0.0.1:8000/
then if your IP is 192.168.0.2 use...
http://192.168.0.2:8000/
If for some reason you want to set the port manually, runserver [port] works...