简体   繁体   中英

How do I redirect Django commands using PyDev?

I would like to run the following Django command (to dump the contents of my database into a text file):

python manage.py dumpdata my_app > data.json

I'm using the Django framework within PyDev as an Eclipse plugin. Therefore, in order to run the above command in PyDev I go to "Custom command" and insert dumpdata my_app > data.json . However, doing so results in an error because of the > character:

Error: Unknown application: >

How can I use > (redirection) in PyDev?

  1. Open Eclipse and go to menu Run > Run configurations
  2. Click on Pydev Django and then the "New" icon to create a new launch configuration
  3. Tab main: select the project and main module ( manage.py )
  4. Tab interpreter: select which interpreter will run manage.py
  5. Tab arguments: write dumpdata my_app in Program arguments
  6. Tab common: check File in "Standard input and Output" and set your output location and filename. Uncheck "Allocate console".

Finally click on Apply and Run. A bit tricky but works as it should.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM