A port of Daniel15's simple-nuget-server because I don't know PHP or Nginx. Runs on Flask and Apache. Python 3.6+
If you're savvy, you could use nginx instead. I am not savvy.
$ sudo apt install apache2
$ sudo apt install libapache2-mod-wsgi-py3
This is highly recommended. I also haven't bothered to figure out how to do a non-venv install so... If you want to do that you're on your own! When you figure it out, please submit a PR for this documentation. 😄
$ python3 -m venv /usr/local/venv-pynuget/ # or anywhere
$ . /usr/local/venv-pynuget/bin/activate
If I've done things correctly, all the requirements should be automatically installed.
$ pip install pynuget
To (hopefully) make things easier, I've included a CLI command that initializes the server with some reasonable defaults. This is pretty undocumented at this time, but my hope is that it will eventually support full customization of the server.
$ sudo -E /usr/local/venv-pynuget/bin/pynuget init
Important
Note the -E
flag on sudo
! This preserves environment variables.
We're specifically interested in the VIRTUAL_ENV
variable, as that's
needed to update the WSGI file.
Note
TODO: Instructions for a system install.
- Sorry that this needs sudo! I haven't come up with a better way around this. Suggestions or PRs welcome!
- This will do various things including but not limited to:
- Creating
/var/www/pynuget
, populating it with the WSGI file and repository folders and adjusting permissions - Copying over the example apache config and enabling the site
- Restarting apache
- Creating
curl localhost
should return a short blurb about nugetOn Windows:
nuget.exe push Foo.nupkg -ApiKey YourApiKey -Source http://your.server.com
On Linux with Mono:
mono /path/to/nuget.exe push Foo.nupkg -ApiKey YourApiKey -Source http://your.server.address
If your server has a Window manager, you can open up a web browser and navigate to
http://localhost
and you should see the PyNuGet landing page.
Make sure to change your secret keys to random values. One way to do so is
outlined in the flask tutorial. You'll need to change 2 values in
/var/www/pynuget/config.py
:
SECRET_KEY API_KEYS