Why my Django server not work suddenly? [closed] - python

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am woking on Ubuntu 12, python2.6 and Django1.2.x which is my test server.
And I run a Django project on my test server using below command:
python manage.py runserver 0.0.0.0:8000
The server can work for most time(I let it run on 7X24 for other teammate to access it), but sometime it would suddenly not work:
Browser shows me that "server not available" when I try to access it.
And of course, the test server cannot get any request from my frontend, and no error throws on server side.
All will back to OK once I using my django project and run it again.
now I have 2 question:
Why does this issue happend?
How can I develop a shell script to detect this situation?

Actually, it looks like you're trying to use Django development for production purposes. There may be a lot of explanations, like apparmor config, or limitation of single-threaded server, but the problem doesn't worth investigating. Just install Apache2, or Nginx, or uwsgi, and that's it, you have good and stable server without shell watchdogs and other kludges. It would probably take about the same time as posting to SO

Related

Django channels: Alternative of Redis for windows machine? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
As per documentation of redis,
A.3.1 Drawbacks of Redis on Windows
Windows doesn’t support the fork system call, which Redis uses in a
variety of situations to dump its database to disk. Without the
ability to fork, Redis is unable to perform some of its necessary
database-saving methods without blocking clients until the dump has
completed.
Questions:
1) If I'm not wrong, this issue will occur when concurrent users increases? Is that correct?
2) Is it really an issue, if we deploy channels on a windows machine (production server)? If yes, is there any better alternative of redis?
3) How to test the above-mentioned drawback on a production server?
Note:
Can't use wsl2(as officially not released) or wsl as the current windows server won't support.
as far as I know to come over this issue you may try one of these options:
setup redis on a docker container using this image and use it in your project.
install linux using a virtualbox and setup redis there.
In both of them since you are running redis in linux environment I don't think you get a problem but like I said try them before going to production. :)
For testing purpose maybe a simulation would work fine first write a test with lots of read and write and try it on both redis on windows and redis on docker and measure the benchmarks.
Memurai is a good Redis for Windows alternative. Memurai is based on Redis source code.

Web2py launch script [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I need a launch script which has access to "db" and other web2py modules. This script must be running constantly. I know that Web2py has launch parameters from which you can run python files in the web2py enviroment, but i don't know how that works. Can this parameter solve my problem and if so, how do I go about it? Thanks!
Look at section 4.17.1 of the web2py manual (or Google "web2py cron").
You can run a script on startup of web2py by registering it in the crontab file as:
"#reboot web2py *scripts/myscript.py"
web2py should be the username that it will run as, which should be the same as what web2py runs as. In my setup I have a user named 'web2py' to run the app.
The asterix before scripts/myscript.py indicates that you want to run the script in the web2py environment.
Keep in mind that you run the risk of locking issues if your script is trying to use the database at the same time as the normal web2py process.

How do I keep Django running on on my web server? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am using dreamhost, and just finished a (as far as I can tell) successful installation of DJango on my VPS using Passenger.
Everything was installed from the shell via SSH - and I even launched the server using the command: python manage.py runserver 0.0.0.0:8888
There are 2 issues I am having with this:
Issue 1 (minor)
I have to access my domain at example.com:8888 - though I assume this could be fixed with some URL rewriting - yeah?
Issue 2 (relatively major)
As soon as I kill the terminal (ending my session) my site becomes inaccessible - how do I keep that from happening?
runserver is intended for development, not production. For running production Django applications on Dreamhost, see the Django page on their wiki.
Dreamhost doesn't allow long running processes, they are killed off quite aggressively, you will have to run it on a per connection basis using Passenger WSGI.

Beginner advice on how to use FTP or SSH? (django) [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm in the midst of trying to get my first website up and running all of the sudden I get to the point where I need to get my file online and I have zero idea on how to do that. I thought it would be as easy as selecting your files and clicking upload but so far it has not been that easy. Currently I'm using djangoeurope.com. So if anyone has experience with that site that would help extra.
If you have ssh access, confirm that it's working by using
ssh [username]#[hostname]
If you can log in using ssh, you can use scp to put your files onto the server (log out of the remote server first)
scp [local_file_path] [hostname]:[remote_file_path]
For example,
scp local.txt files.server.com:/home/local.txt
This should work from a terminal on a Mac or Linux system. If you're on Windows, you should look at WinSCP
If you sign up with Heroku, your deployment process is very straightforward, and as an added bonus you do not have to deal with FTP and server configuration.
There are different tools for FTP and SSH file transfer. Which one is best for you depends on your environment (e.g. operating system) and your needs (do you want a graphical or command line interface?). But basically it's always a program you run on your machine that connects to a server to upload files. You don't do anything through a web site (except finding out which server to connect to and maybe setting up an account / password).

Does any webhosting service that supports python also supports django? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm trying to learn python/django, these are installed on my desktop computer and all the examples run fine. My question is: If a webhosting service supports python (2.4), does the webhosting service supports django by default?
Thanks guys.
You can use Google App Engine, which is free and includes Django.
Yes, but if they only support Python via CGI then your application will be very, very slow. Best is WSGI, then FastCGI, then mod_python.
Not necessarily.Many web hosting companies(shared) claim to offer django but this is a big lie.Case in point,a2hosting claims to have django but don't offer it;its disallowed.I tried to compile my own python and install django and found out that that path is also closed.
Django is memory intensive and will only work on vps and dedicated accounts.Web faction though is the only web host that wont lie to you.
Try Fornex VPS. https://fornex.com/vds/
I use it and like very much. Month payment starts from 5 euros. And you can install apache 2 + wsgi.

Categories