2

Hi everyone i'm trying to learn the django framework and I'm using PyDev (Eclipse Python Development Framework/Plugin). When I try to run my application I get an error:

Error: [Errno 10013]

I know that this is because of the port. I use the port 8000 and i want to change it to 8080. Does anyone knows what exactly should i do to change the port?

 pydev debugger: starting
 Validating models...

 0 errors found
 Django version 1.3.1, using settings 'muapp.settings'
 Development server is running at http://127.0.0.1:8000/
 Quit the server with CTRL-BREAK.
 Error: [Errno 10013]

It might be useful to point out that PyDev, like Eclipse, runs the configured command when the Run button is pressed. How is the default command and/or its options changed?

ILMostro_7
  • 1,422
  • 20
  • 28
arnold leki
  • 267
  • 2
  • 9
  • 18
  • I'm not familiar with pydev, but this might help. You need to replace something like `./manage.py runserver` with `./manage.py runserver 8080`. – Alasdair Jan 11 '12 at 21:45
  • thank you Alasdair for your your response. I know that but the problem is that i don't know how to do this in pydev. – arnold leki Jan 11 '12 at 22:10
  • Does this video help? http://vimeo.com/5027645. Skip about 14 minutes in. Then use `runserver 8080` instead of `runserver 8000` in the arguments. – Alasdair Jan 11 '12 at 23:40
  • Glad it helped! I'll add the comment as an answer so you can mark it as accepted. – Alasdair Jan 12 '12 at 00:01

2 Answers2

3

Have a look at this video tutorial. Skip about 14 minutes in. Then use runserver 8080 instead of runserver in the arguments.

Alasdair
  • 298,606
  • 55
  • 578
  • 516
  • **Any** usful information that can be added is appreciated. Simply addink a vague link, however, might be useful as a comment. What's the procedure to change the default `Run` command in Eclipse/PyDev? That's the question, rather than, "have a look at this video for my question". – ILMostro_7 Jun 21 '16 at 16:28
  • @ILMostro_7 I agree that this answer could be clearer, but as I said I don't use pydev so I am not the person to improve it. You are very welcome to suggest edits to the answer to provide more details, or write an alternative answer. However I'd disagree with your description of the link as 'vague' -- it showed the OP what they needed to do, and solved their problem. – Alasdair Jun 21 '16 at 16:39
  • It's "vague" because it's a link, rather than "according to that link, you do this....". – ILMostro_7 Jun 21 '16 at 23:00
1

Please take a look at the PyDev Documentation on how to change the Run configuration.

Run/Debug as Django

Run as Django/Debug as Django are available (note that they set the --noreload by default).

This will create a default Run configuration, so, you may edit it later through run > run configurations (or debug > debug configurations) if you want to change a parameter.

Note: to know how to rerun the last launch see: the Rerun Last Launch topic on PyDev Launching

Note 2: if the --noreload is not passed, only the parent process will be killed from Eclipse and the others will only be killed when they'd be reloaded (i.e.: on a code-change).

Whether it's "Eclipse" or "PyDev", right-click on the Project and select "Run As" --> "Run Configurations..."

Run Configuration

Additionally, according to the django Documentation,

runserver [addrport]¶

Starts a lightweight development Web server on the local machine. By default, the server runs on port 8000 on the IP address 127.0.0.1. You can pass in an IP address and port number explicitly.

Therefore, in your Project's Run Configuration, on the Arguments tab, simply add:

runserver 0.0.0.0:8080

This should have the server listen on all interfaces/IPs. Alternatively, you can make it more specific to your public-facing IP instead:

runserver 123.456.789.123:45678

Please, note that in this case, my IP would be "123.456.789.123" and the port would be "45678".


The following Answers might also be of use:

Community
  • 1
  • 1
ILMostro_7
  • 1,422
  • 20
  • 28