Aerospace community project with Python and Django framework

· By Seokhyeon Byun

Why did I start this project?

After studying Python as my first programming language, I wanted to build something that would produce visual results that anyone could see and that would be useful. There were many possible things to do with Python, such as machine learning and data science. I thought Web development was a relatively easier and faster way to create a visual project.

If you have ever studied or watched people’s interviews who major in computer science, you might have heard of platforms such as ‘Stackoverflow,’ ‘LeetCode,’ and ‘Hackerton.’ These platforms help many newbie programmers practice and learn programming effectively and have affected the entire Tech industry. For example, if you want to get a job at Google, Facebook, or Microsoft, companies ask you to take coding interviews or coding tests. That kind of method has settled in the application process for many tech companies. Now, it is natural for the applicants to practice programming, coding interviews via platforms like LeetCode and using a programming-focused Q&A website like Stackoverflow.

However, I felt a void in other engineering industries, like mechanical or aerospace engineering. There seemed to be a gap between schools and companies and a lack of resources to help students prepare themselves to become proficient engineers before they entered the workforce. This disparity and my passion for aerospace engineering sparked a desire to create something meaningful.

Then, a question arose in my mind: ‘Why is there no community platform for aerospace engineering similar to Stackoverflow?‘. I scoured the internet but couldn’t find any website or platform that catered to the needs of aerospace engineers like the ones programmers have. This realization ignited a spark of initiative, and I decided to build it myself. This idea took shape in July 2020, just before I joined the Korean Military. With some time on my hands before my service, I was determined to use it productively and innovatively.

Tech stack I chose

  • Python, Django
  • HTML, CSS, Bootstrap
  • Google Cloud Platform for host
  • AWS s3 to store static data
  • PostgreSQL for database

How did I build this project? (July 2020 ~ January 2021)

For this project, I wanted to leverage my first programming language, Python, and build a website. After careful consideration and research, I found a framework that fits my needs perfectly: Django. Django uses the MVT (Model-View-Template) design pattern, where models represent data from a database, the views handle requests and return templates with content, and templates define the layout of web pages. Templates are basically frontend parts consisting of HTML, CSS, and Javascript. Django also provides its own admin page to manage the users, which was the other reason Django was chosen for this project.

Project structures (tree)

- community
	- migrations
	- templates/community
	- __init__.py
	- admin.py
	- apps.py
	- forms.py
	- models.py
	- tests.py
	- urls.py
	- views.py
- members
	- migrations
	- templates/registration
	- __init__.py
	- admin.py
	- apps.py
	- models.py
	- signals.py
	- tests.py
	- urls.py
	- views.py
- project1
	- __init__.py
	- asgi.py
	- settings.py
	- storages.py
	- urls.py
	- wsgi.py
- main.py
- manage.py

After installing Django with pip3 install django, the django-admin startproject PROJECT_NAME command will be used to create a project. This command creates the pre-generated files under the project1 directory.

Project1 directory

__init__.py tells Python to treat the directory as the Python package. asgi.py and wsgi.py allow Django to communicate with the web servers. Next, settings.py is used to modify the database (for this project, from SQLite to PostgreSQL), middleware, and other important stuff. urls.py helps configure the project with different URLs. manage.py is used to run database migrations and run the Python server.

community & members directory

After creating the project, the python manage.py startapp APPNAME command creates an app that allows users to see the application visually. For this project, the community directory is the application that handles CRUD functionality with HTTP requests, and the members directory is the application that manages the user authentication and membership. To achieve the CRUD, forms.py would ‘create,’ ‘delete,’ ‘update,’ and ‘read,’ and the data are also correspondingly updated on the database via models.py.

Challenges I faced

  • Lack of knowledge of Javascript
  • Deploying a website from scratch
  • Lack of knowledge of Database, how to effectively structure SQL in PostgreSQL
  • Lack of knowledge of scalability of static data in AWS
  • Limited time left before the military

Even though Django provides full-stack features like connecting frontend and backend behind the scene, trying first time project as well as full-stack was very challenging especially it’s hard to make UIUX from my thought with lack of frontend skills.

Creating the project wasn’t the only thing. To make this website accessible to everyone on the Internet, it needed to be deployed. The deployment process was challenging at this time. Static files like images were stored in an AWS S3 bucket to reduce the price of keeping everything on GCP, and thus, Google Cloud Platform was only used as the host. Even after deployment, connecting the PostgreSQL database and only allowing signed-in users to make posts, comments, or delete on the website took much time to fix.

After the deployment process was done, I wanted to do marketing and update more features, but I had no time left. I didn’t expect this to take almost seven months to build and deploy. During military service, I wasn’t allowed to use my personal laptop so that I couldn’t shut down this project. Later, I was overcharged by both Google and AWS.

What I learned

  • Python virtual environment
  • CRUD (Create-Read-Update-Delete)
  • SQL Database migration
  • git version control process
  • Lack of knowledge of environmental variables with .env

Using a virtual environment wasn’t necessary, but it was an interesting way to save dependencies for large-scale projects.

Since it was my first time not even just a frontend but a full-stack project with a lack of knowledge required before proceeding with the project, such as git version control and environmental variables to save sensitive information, when I did build the project, I accidentally git commit and git push the credential information of AWS and Google Cloud Platform (GCP) to the GitHub repository, which is why this project is maintained as private.

I realized Python wasn’t the best language for web development, and I needed to learn front-end skills like Javascript to make the website more dynamic.