Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Softonauts #13

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions Softonauts/Backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Python Starter

Quickly get started with [Python](https://www.python.org/) using this starter!

- If you want to upgrade Python, you can change the image in the [Dockerfile](./.codesandbox/Dockerfile).
46 changes: 46 additions & 0 deletions Softonauts/Backend/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import pdfkit
from flask import Flask, render_template, make_response, request
from flask_cors import CORS
app = Flask(__name__)
CORS(app, resources={r'/*': {'origins': '*'}})
@app.route('/', methods=['GET', 'POST'])
def home():
if request.method == 'POST':
# Variables to pass to the template
data = request.get_json()
name = data.get('name')
source = data.get('source')
print(source)
destination = data.get('destination')
srcdistance = data.get('srcdistance', '35')
planet = destination + '.html' if destination else None


planet_weather = {
'Mercury': 'extremely hot during the day, extremely cold at night',
'Venus': 'hot and cloudy with sulfuric acid clouds',
'Earth': 'mild with variable climates',
'Mars': 'cold and dry with thin atmosphere',
'Jupiter': 'extremely cold with violent storms',
'Saturn': 'extremely cold with high-speed winds',
'Uranus': 'cold with a cloudy and hazy atmosphere',
'Neptune': 'extremely cold and windy',
'Pluto': 'extremely cold and rocky'
}
# Render the Jinja2 template to a string
html = render_template(planet, name=name, source=source, destination=destination, srcdistance=srcdistance, srcatmosphere=planet_weather[source], dstatmosphere=planet_weather[destination])

# Create a PDF from the HTML string
pdf = pdfkit.from_string(html, False)

# Create a response with the PDF data
response = make_response(pdf)
response.headers['Content-Type'] = 'application/pdf'
response.headers['Content-Disposition'] = f'inline; filename={destination}_itinerary.pdf'

return response
else:
return "This endpoint accepts POST requests only."

if __name__ == '__main__':
app.run(debug=True)
4 changes: 4 additions & 0 deletions Softonauts/Backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Flask==2.3.3
jinja2
pdfkit
wkhtmltopdf
77 changes: 77 additions & 0 deletions Softonauts/Backend/templates/Jupiter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #212121;
margin: 0;
padding: 0;
height: 1400px;
}
.email-container {
font-size: 1.20em;
height: 80%;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
margin: 20px auto;
max-width: 800px;
}
.email-header {
font-size: xx-large;

background-color: #ff6f00; /* Updated color */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding: 10px;
text-align: center;
}
p {
margin: 10px 0;
}
.signature {
color: #888888;
}
</style>
</head>
<body>
<div class="email-container">
<div class="email-header">
<p>Greetings {{name}},</p>
</div>
<p>We are thrilled for you to embark on this incredible space adventure from {{source}} to {{destination}}. The journey from {{source}} to {{destination}}, which is {{srcdistance}} million miles away, will be a unique experience. <b>The weather at {{source}} is {{srcatmosphere}}, while the weather at {{destination}} is {{dstatmosphere}}.</b> This journey will give you a firsthand experience of the stark contrast between the two planets. Let's dive into your exciting one-week itinerary:</p>
<p><strong>Day 1:</strong> Your journey begins with a momentous launch from {{source}}. Feel the rumble of the rockets as you accelerate out of the atmosphere and into the vastness of space. Watch our planet get smaller and smaller as you head towards your destination.</p>

<p><strong>Day 2-3:</strong> Cruise through the solar system towards Jupiter. Gaze out the window at passing planets, asteroids, and other celestial wonders. The endless blackness dotted with stars will make you feel so small yet filled with wonder. Enjoy zero gravity as you float around the cabin.</p>

<p><strong>Day 4:</strong> Strap on your spacesuit and oxygen tank to explore Jupiter's moons. Start with Ganymede, the largest moon in the solar system, and then head to Europa, which may harbor life beneath its icy surface.</p>

<p><strong>Day 5:</strong> Venture to Jupiter's Great Red Spot, a storm larger than Earth that has been raging for hundreds of years. This is a sight you won't want to miss!</p>

<p><strong>Day 6:</strong> Spend the day studying Jupiter's complex cloud patterns and intense magnetic field. These features make Jupiter one of the most scientifically interesting bodies in our solar system.</p>

<p><strong>Day 7:</strong> Begin the return voyage to Earth. Reminisce on your amazing Jovian experiences. Journal, watch movies, play games, and chat with friends back home through video messages. One day, share your once-in-a-lifetime journey with others to inspire the next generation of space explorers.</p>

<p>Please take note of these precautions for your journey:</p>

<ul>
<li>Pack plenty of freeze-dried astronaut food and water</li>
<li>Bring motion sickness medication for the long space travel</li>
<li>Make sure your spacesuit and equipment are in top condition</li>
<li>Jupiter's atmosphere is made up mostly of hydrogen and helium, so ensure your suit can withstand these conditions</li>
</ul>

<p>We wish you an incredible adventure! Reach out with any other questions. </p>
<br>

<p class="signature" style="color:#ff6f00;font-weight: bold;">Safe travels,<br>
Softonauts Team</p>

</div>

</body>
</html>
76 changes: 76 additions & 0 deletions Softonauts/Backend/templates/Mars.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #212121;
margin: 0;
padding: 0;
height: 1400px;
}
.email-container {
font-size: 1.20em;
height: 80%;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
margin: 20px auto;
max-width: 800px;
}
.email-header {
font-size: xx-large;

background-color: #ff6f00; /* Updated color */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding: 10px;
text-align: center;
}
p {
margin: 10px 0;
}
.signature {
color: #888888;
}
</style>
</head>
<body>

<div class="email-container">

<div class="email-header">

<p>Greetings {{name}},</p>

</div>

<p>We are thrilled for you to embark on this incredible space adventure from {{source}} to {{destination}}. The journey from {{source}} to {{destination}} is {{srcdistance}} million miles away, will be a unique experience. <b>The weather at {{source}} is {{srcatmosphere}}, while the weather at {{destination}} is {{dstatmosphere}}.</b> This journey will give you a firsthand experience of the stark contrast between the two planets. Let's dive into your exciting one-week itinerary:</p>
<p><strong>Day 1:</strong> Your journey begins with a momentous launch from {{source}}. Feel the rumble of the rockets as you accelerate out of the atmosphere and into the vastness of space. Watch our planet get smaller and smaller as you head towards your destination.</p>

<p><strong>Day 2-3:</strong> Cruise through the solar system towards Mars. Gaze out the window at passing planets, asteroids, and other celestial wonders. The endless blackness dotted with stars will make you feel so small yet filled with wonder. Enjoy zero gravity as you float around the cabin.</p>

<p><strong>Day 4:</strong> Strap on your spacesuit and oxygen tank to summit Mount Olympus. At an elevation of over 21,000 feet, it will be a challenging hike. But once at the peak, you'll be rewarded with a breathtaking 360 degree panorama of the rusty Martian landscape. See if you can spot the polar ice caps!</p>

<p><strong>Day 5:</strong> Venture to Phobos, one of Mars' mysterious moons. Walk along the surface and explore its massive crater Stickney, caused by a major impact. Phobos offers unique perspectives on Mars against the backdrop of space. Spend a quiet moment contemplating our place in the universe.</p>

<p><strong>Day 6:</strong> Meet up with Curiosity, NASA's intrepid Mars rover. Chat "face-to-face" with engineers on Earth as Curiosity shows you around its exciting discoveries. See the rover's laser zap rocks, dig trenches, and analyze soil samples up close.</p>

<p><strong>Day 7:</strong> Begin the three month long return voyage to Earth. Reminisce on your amazing Martian experiences. Journal, watch movies, play games, and chat with friends back home through video messages. One day, share your once-in-a-lifetime journey with others to inspire the next generation of space explorers.</p>

<p>Please take note of these precautions for your journey:</p>

<ul> <li>Pack plenty of freeze-dried astronaut food and water</li> <li>Bring motion sickness medication for the long space travel</li> <li>Make sure your spacesuit and equipment are in top condition</li></ul>

<p>We wish you an incredible adventure! Reach out with any other questions. </p>
<br>

<p class="signature" style="color:#ff6f00;font-weight: bold;">Safe travels,<br>
Softonauts Team</p>

</div>
</body>
</html>
78 changes: 78 additions & 0 deletions Softonauts/Backend/templates/Mercury.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #212121;
margin: 0;
padding: 0;
height: 1400px;
}
.email-container {
font-size: 1.20em;
height: 80%;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
margin: 20px auto;
max-width: 800px;
}
.email-header {
font-size: xx-large;

background-color: #ff6f00; /* Updated color */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding: 10px;
text-align: center;
}
p {
margin: 10px 0;
}
.signature {
color: #888888;
}
</style>
</head>
<body>

<div class="email-container">
<div class="email-header">
<p>Greetings {{name}},</p>
</div>
<p>We are thrilled for you to embark on this incredible space adventure from {{source}} to {{destination}}. The journey from {{source}} to {{destination}}, which is {{srcdistance}} million miles away, will be a unique experience. <b>The weather at {{source}} is {{srcatmosphere}}, while the weather at {{destination}} is {{dstatmosphere}}.</b> This journey will give you a firsthand experience of the stark contrast between the two planets. Let's dive into your exciting one-week itinerary:</p>
<p><strong>Day 1:</strong> Your journey begins with a momentous launch from {{source}}. Feel the rumble of the rockets as you accelerate out of the atmosphere and into the vastness of space. Watch our planet get smaller and smaller as you head towards your destination.</p>

<p><strong>Day 2-3:</strong> Cruise through the solar system towards Mercury. Gaze out the window at passing planets, asteroids, and other celestial wonders. The endless blackness dotted with stars will make you feel so small yet filled with wonder. Enjoy zero gravity as you float around the cabin.</p>

<p><strong>Day 4:</strong> Strap on your spacesuit and oxygen tank to explore Mercury's surface. Be prepared for extreme temperatures as Mercury has the most extreme temperature fluctuations in the solar system.</p>

<p><strong>Day 5:</strong> Venture to one of Mercury's massive craters. These craters were formed by impacts from asteroids and comets, and exploring them will give you a sense of the violent history of our solar system.</p>

<p><strong>Day 6:</strong> Spend the day studying Mercury's thin atmosphere and magnetic field. Despite being so close to the Sun, Mercury has a very thin atmosphere compared to other planets.</p>

<p><strong>Day 7:</strong> Begin the return voyage to Earth. Reminisce on your amazing Mercurian experiences. Journal, watch movies, play games, and chat with friends back home through video messages. One day, share your once-in-a-lifetime journey with others to inspire the next generation of space explorers.</p>

<p>Please take note of these precautions for your journey:</p>

<ul>
<li>Pack plenty of freeze-dried astronaut food and water</li>
<li>Bring motion sickness medication for the long space travel</li>
<li>Make sure your spacesuit and equipment are in top condition</li>
<li>Mercury's surface experiences extreme temperatures, so ensure your suit can withstand these conditions</li>
</ul>

<p>We wish you an incredible adventure! Reach out with any other questions. </p>
<br>

<p class="signature" style="color:#ff6f00;font-weight: bold;">Safe travels,<br>
Softonauts Team</p>

</div>

</body>
</html>
78 changes: 78 additions & 0 deletions Softonauts/Backend/templates/Neptune.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #212121;
margin: 0;
padding: 0;
height: 1400px;
}
.email-container {
font-size: 1.20em;
height: 80%;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
margin: 20px auto;
max-width: 800px;
}
.email-header {
font-size: xx-large;

background-color: #ff6f00; /* Updated color */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding: 10px;
text-align: center;
}
p {
margin: 10px 0;
}
.signature {
color: #888888;
}
</style>
</head>
<body>

<div class="email-container">
<div class="email-header">
<p>Greetings {{name}},</p>
</div>
<p>We are thrilled for you to embark on this incredible space adventure from {{source}} to {{destination}}. The journey from {{source}} to {{destination}}, which is {{srcdistance}} million miles away, will be a unique experience. <b>The weather at {{source}} is {{srcatmosphere}}, while the weather at {{destination}} is {{dstatmosphere}}.</b> This journey will give you a firsthand experience of the stark contrast between the two planets. Let's dive into your exciting one-week itinerary:</p>
<p><strong>Day 1:</strong> Your journey begins with a momentous launch from {{source}}. Feel the rumble of the rockets as you accelerate out of the atmosphere and into the vastness of space. Watch our planet get smaller and smaller as you head towards your destination.</p>

<p><strong>Day 2-3:</strong> Cruise through the solar system towards Neptune. Gaze out the window at passing planets, asteroids, and other celestial wonders. The endless blackness dotted with stars will make you feel so small yet filled with wonder. Enjoy zero gravity as you float around the cabin.</p>

<p><strong>Day 4:</strong> Strap on your spacesuit and oxygen tank to explore Neptune's atmosphere. Be prepared for extreme cold temperatures and high-speed winds.</p>

<p><strong>Day 5:</strong> Venture to Triton, Neptune's largest moon. Triton is known for its geysers that spout nitrogen gas, making it one of the most interesting celestial bodies in our solar system.</p>

<p><strong>Day 6:</strong> Spend the day studying Neptune's complex cloud patterns and intense magnetic field. These features make Neptune one of the most scientifically interesting bodies in our solar system.</p>

<p><strong>Day 7:</strong> Begin the return voyage to Earth. Reminisce on your amazing Neptunian experiences. Journal, watch movies, play games, and chat with friends back home through video messages. One day, share your once-in-a-lifetime journey with others to inspire the next generation of space explorers.</p>

<p>Please take note of these precautions for your journey:</p>

<ul>
<li>Pack plenty of freeze-dried astronaut food and water</li>
<li>Bring motion sickness medication for the long space travel</li>
<li>Make sure your spacesuit and equipment are in top condition</li>
<li>Neptune's atmosphere is made up mostly of hydrogen and helium, so ensure your suit can withstand these conditions</li>
</ul>

<p>We wish you an incredible adventure! Reach out with any other questions. </p>
<br>

<p class="signature" style="color:#ff6f00;font-weight: bold;">Safe travels,<br>
Softonauts Team</p>

</div>

</body>
</html>
Loading