This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # views.py | |
| class EventFeed(ICalFeed): | |
| """ | |
| A simple event calender | |
| """ | |
| product_id = '-//example.com//Example//EN' | |
| timezone = 'UTC' | |
| file_name = "event.ics" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ICalFeed(Feed): | |
| # comments | |
| feed_type = feedgenerator.DefaultFeed | |
| def __call__(self, request, *args, **kwargs): | |
| """ | |
| Copied from django.contrib.syndication.views.Feed | |
| Supports file_name as a dynamic attr. | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EventFeed(ICalFeed): | |
| """ | |
| A simple event calender | |
| """ | |
| product_id = '-//example.com//Example//EN' | |
| timezone = 'UTC' | |
| file_name = "event.ics" | |
| def __call__(self, request, *args, **kwargs): | |
| self.request = request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def items(self): | |
| return Event.objects.filter(user=request.user).order_by('-date') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function mainFunction() { | |
| const returnFunction = function fetchFunction(dispatch) { | |
| const fetchConfig = { | |
| url: '/api/endpoint/', | |
| httpMethod: 'get', | |
| successStatusCode: 200, | |
| successCallback: (res) => { | |
| //execute if successful | |
| }, | |
| errorCallback: (err) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const outerFunctionName = function innerFunctionName() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl https://getcaddy.com | bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my-domain.com, www.my-domain.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Caddy Server startup script for static website | |
| [Service] | |
| WorkingDirectory=/code/static-website/ | |
| ExecStart=/usr/local/bin/caddy | |
| Restart=always | |
| [Install] | |
| WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cp caddy_static_site.service /etc/systemd/system/caddy_static_site.service | |
| systemctl daemon-reload | |
| systemctl enable caddy_static_site.service | |
| systemctl start caddy_static_site.service | |
| sudo systemctl status caddy_static_site.service # get status of the service - should be active |